new auth services
This commit is contained in:
parent
e64d0a8c02
commit
c1a36515b1
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "directus-helpers",
|
"name": "directus-helpers",
|
||||||
"version": "1.4.0",
|
"version": "1.5.0",
|
||||||
"description": "Helpers Directus Extensions",
|
"description": "Helpers Directus Extensions",
|
||||||
"author": "AntoXa PRO <info@antoxa.pro>",
|
"author": "AntoXa PRO <info@antoxa.pro>",
|
||||||
"homepage": "https://antoxahub.ru/antoxa/directus-helpers",
|
"homepage": "https://antoxahub.ru/antoxa/directus-helpers",
|
||||||
|
@ -3,7 +3,9 @@ import type {
|
|||||||
ItemsService,
|
ItemsService,
|
||||||
FilesService,
|
FilesService,
|
||||||
UsersService,
|
UsersService,
|
||||||
RolesService
|
RolesService,
|
||||||
|
AuthorizationService,
|
||||||
|
AuthenticationService
|
||||||
} from '@directus/api/dist/services'
|
} from '@directus/api/dist/services'
|
||||||
|
|
||||||
export type TFactoryServicesOpts = {
|
export type TFactoryServicesOpts = {
|
||||||
@ -22,6 +24,8 @@ export class FactoryServices<TTypes extends TFactoryTypes = any> {
|
|||||||
private _files: FilesService | null = null
|
private _files: FilesService | null = null
|
||||||
private _users: UsersService | null = null
|
private _users: UsersService | null = null
|
||||||
private _roles: RolesService | null = null
|
private _roles: RolesService | null = null
|
||||||
|
private _authorization: AuthorizationService | null = null
|
||||||
|
private _authentication: AuthenticationService | null = null
|
||||||
|
|
||||||
constructor(opts: TFactoryServicesOpts) {
|
constructor(opts: TFactoryServicesOpts) {
|
||||||
this.opts = opts
|
this.opts = opts
|
||||||
@ -68,4 +72,24 @@ export class FactoryServices<TTypes extends TFactoryTypes = any> {
|
|||||||
}
|
}
|
||||||
return this._roles as RolesService
|
return this._roles as RolesService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get authorization() {
|
||||||
|
if (!this._authorization) {
|
||||||
|
this._roles = new this.opts.services.AuthorizationService({
|
||||||
|
schema: this.opts.schema,
|
||||||
|
accountability: this.opts.accountability
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return this._authorization as AuthorizationService
|
||||||
|
}
|
||||||
|
|
||||||
|
get authentication() {
|
||||||
|
if (!this._authentication) {
|
||||||
|
this._roles = new this.opts.services.AuthenticationService({
|
||||||
|
schema: this.opts.schema,
|
||||||
|
accountability: this.opts.accountability
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return this._authentication as AuthenticationService
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user