@huntsman-cancer-institute/user 16.0.1 → 17.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/authorization/permission.entity.d.ts +34 -34
- package/authorization/role-check-unless-null.directive.d.ts +25 -25
- package/authorization/role-check.directive.d.ts +26 -26
- package/authorization/role.entity.d.ts +27 -27
- package/esm2022/authorization/permission.entity.mjs +44 -44
- package/esm2022/authorization/role-check-unless-null.directive.mjs +62 -62
- package/esm2022/authorization/role-check.directive.mjs +66 -66
- package/esm2022/authorization/role.entity.mjs +31 -31
- package/esm2022/huntsman-cancer-institute-user.mjs +4 -4
- package/esm2022/index.mjs +19 -19
- package/esm2022/user.entity.mjs +69 -69
- package/esm2022/user.module.mjs +53 -53
- package/esm2022/user.service.mjs +98 -98
- package/fesm2022/huntsman-cancer-institute-user.mjs +397 -397
- package/fesm2022/huntsman-cancer-institute-user.mjs.map +1 -1
- package/index.d.ts +16 -16
- package/package.json +3 -3
- package/user.entity.d.ts +57 -57
- package/user.module.d.ts +17 -17
- package/user.service.d.ts +40 -40
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"huntsman-cancer-institute-user.mjs","sources":["../../../projects/user/src/user.entity.ts","../../../projects/user/src/authorization/role.entity.ts","../../../projects/user/src/authorization/permission.entity.ts","../../../projects/user/src/user.service.ts","../../../projects/user/src/authorization/role-check.directive.ts","../../../projects/user/src/authorization/role-check-unless-null.directive.ts","../../../projects/user/src/user.module.ts","../../../projects/user/src/index.ts","../../../projects/user/src/huntsman-cancer-institute-user.ts"],"sourcesContent":["/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\nimport {RoleEntity} from \"./authorization/role.entity\";\r\n\r\n/**\r\n * An immutable representation of an HCI user entity.\r\n *\r\n * @since 1.0.0\r\n */\r\nexport class UserEntity {\r\n constructor(private id: string,\r\n private username: string,\r\n private roles?: RoleEntity[],\r\n private firstname?: string,\r\n private lastname?: string,\r\n private href?: string) {\r\n }\r\n\r\n /**\r\n * An accessor for the users system id.\r\n *\r\n * @returns {string} the system id\r\n * @constructor\r\n */\r\n get Id(): string {\r\n return this.id;\r\n }\r\n\r\n /**\r\n * An accessor for the users application identifier/username.\r\n *\r\n * @returns {string} the application id/username\r\n * @constructor\r\n */\r\n get Username(): string {\r\n return this.username;\r\n }\r\n\r\n /**\r\n * An accessor for the users assigned role authorization claims.\r\n *\r\n * @returns {@code RoleEntity[]} the role authorization claims\r\n * @constructor\r\n */\r\n get Roles(): RoleEntity[] {\r\n return this.roles;\r\n }\r\n\r\n /**\r\n * An accessor for the users firstname.\r\n *\r\n * @return {string} the firstname\r\n * @constructor\r\n */\r\n get Firstname(): string {\r\n return this.firstname;\r\n }\r\n\r\n /**\r\n * A accessor for the users lastname.\r\n *\r\n * @return {string} the lastname\r\n * @constructor\r\n */\r\n get Lastname(): string {\r\n return this.lastname;\r\n }\r\n\r\n /**\r\n * A access for the users fully qualified href location on the system.\r\n *\r\n * @return {string} the href location\r\n * @constructor\r\n */\r\n get Href(): string {\r\n return this.href;\r\n }\r\n\r\n}\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\nimport {PermissionEntity} from \"./permission.entity\";\r\n\r\n/**\r\n * An immutable representation of an HCI role entity, which represents an authorization claim associated with an authenticated\r\n * subject.\r\n *\r\n * @since 1.0.0\r\n */\r\nexport class RoleEntity {\r\n constructor( private roleName: string, private permissions?: PermissionEntity[]) {}\r\n\r\n /**\r\n * An accessor for the name of this role.\r\n *\r\n * @returns {string} the role name\r\n * @constructor\r\n */\r\n get RoleName(): string {\r\n return this.roleName;\r\n }\r\n\r\n /**\r\n * An accessor for a collection of {@link PermissionEntity} authorization claims that define this role. Permissions\r\n * provide a finer grained authorization claim description and are not required.\r\n *\r\n * @returns {PermissionEntity[]} a collection of permission entities\r\n * @constructor\r\n */\r\n get Permissions(): PermissionEntity[] {\r\n return this.permissions;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\n/**\r\n * An immutable representation of an HCI permission entity, which represents a fine grained authorization claim that can\r\n * define a {@link RoleEntity}.\r\n *\r\n * @since 1.0.0\r\n */\r\nexport class PermissionEntity {\r\n constructor(private domain: string, private actions?: string[], private instances?: string[]) {\r\n }\r\n\r\n /**\r\n * An accessor for the domain this permission is defined for (i.e. user, study, specimen, etc...).\r\n *\r\n * @returns {string} the domain of this permission\r\n * @constructor\r\n */\r\n get Domain(): string {\r\n return this.domain;\r\n }\r\n\r\n /**\r\n * An accessor for the actions that this permission allows in the specified domain (i.e. create, read, activate, manage\r\n * etc...). If no actions are defined, this permission claims access to all actions of the specified domain.\r\n *\r\n * @returns {string[]} an array of actions for the specified domain\r\n * @constructor\r\n */\r\n get Actions(): string[] {\r\n return this.actions;\r\n }\r\n\r\n /**\r\n * An accessor for the instances that this permission is applicable to in the specified domain (i.e. joe, 1234, study-foo,\r\n * etc...). If no instances are defined, this permission claims applicability to all instances of the specified domain.\r\n * @returns {string[]}\r\n * @constructor\r\n */\r\n get Instances(): string[] {\r\n return this.instances;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\nimport {Injectable, InjectionToken, Inject, isDevMode} from \"@angular/core\";\r\nimport {HttpClient, HttpResponse, HttpHeaders} from \"@angular/common/http\";\r\n\r\nimport {Observable, of, throwError} from \"rxjs\";\r\nimport {catchError, map} from \"rxjs/operators\";\r\n\r\nimport {UserEntity} from \"./user.entity\";\r\nimport {RoleEntity} from \"./authorization/role.entity\";\r\nimport {PermissionEntity} from \"./authorization/permission.entity\";\r\n\r\nexport let AUTHENTICATED_USER_ENDPOINT = new InjectionToken<string>(\"authenticated_user_url\");\r\n\r\n/**\r\n * @since 1.0.0\r\n */\r\n@Injectable()\r\nexport class UserService {\r\n /**\r\n * The generic error message used when a server error is thrown without a status.\r\n *\r\n * @type {string}\r\n */\r\n public static GENERIC_ERR_MSG: string = \"Server error\";\r\n\r\n private _authenticatedUser: UserEntity = null;\r\n\r\n constructor(private _http: HttpClient, @Inject(AUTHENTICATED_USER_ENDPOINT) private _authenticationUserEndpoint: string) {}\r\n\r\n /**\r\n * An accessor for an {@code Observable<UserEntity>} reflecting the currently authenticated user. If no subject is\r\n * available, the appropriate response status should be returned from the server to indicate that condition\r\n * (i.e. 404 - Not Found).\r\n *\r\n * @returns {Observable<UserEntity>} the currently authenticated user representation\r\n */\r\n public getAuthenticatedUser(): Observable<UserEntity> {\r\n if (isDevMode() && <any>console && <any>console.debug) {\r\n console.debug(\"getAuthenticatedUser\");\r\n }\r\n\r\n if (!this._authenticatedUser) {\r\n if (isDevMode() && <any>console && <any>console.debug) {\r\n console.debug(\"_authenticationUserEndpoint: \" + this._authenticationUserEndpoint);\r\n }\r\n\r\n return this._http.get(this._authenticationUserEndpoint, { observe: \"response\" }).pipe(map((resp: HttpResponse<any>) => {\r\n if (resp.status === 200) {\r\n this._authenticatedUser = this.buildUserEntity(resp.body);\r\n return this._authenticatedUser;\r\n } else {\r\n throw new Error(\"Get authenticated user failed. \" + resp.status + \": \" + resp.statusText);\r\n }\r\n }),\r\n catchError(this.handleError));\r\n } else {\r\n return of(this._authenticatedUser);\r\n }\r\n }\r\n\r\n private handleError(error: any) {\r\n let errMsg = (error.message) ? error.message : UserService.GENERIC_ERR_MSG;\r\n \r\n return throwError(() => new Error(errMsg));\r\n }\r\n\r\n /**\r\n * TODO: Add in a deserializer into the entity.\r\n *\r\n * @param userJson\r\n * @returns {UserEntity}\r\n */\r\n private buildUserEntity(userJson: any): UserEntity {\r\n let roles: RoleEntity[] = [];\r\n if (userJson.roles) {\r\n userJson.roles.map((role: any) => {\r\n let permissions: PermissionEntity[];\r\n if (role.permissions) {\r\n /* TODO: JEH (10/27/16) - Revisit when we determine how permission are communicated to the client, if necessary */\r\n permissions = role.permissions.map((permission: any) => {\r\n return new PermissionEntity(permission.domain, permission.actions, permission.instances);\r\n });\r\n }\r\n roles.push(new RoleEntity(role.roleName, permissions));\r\n });\r\n }\r\n\r\n return new UserEntity(userJson.idUser, userJson.username, roles, userJson.firstname, userJson.lastname, userJson.href);\r\n }\r\n \r\n public getPermissions(governorClass: string, governorId: number, governedClass: string): Observable<any> {\r\n let headers = new HttpHeaders()\r\n .set(\"SecurityGovernorClass\", governorClass).set(\"SecurityGovernorId\", String(governorId));\r\n return this._http.get(\"/core/api/user/permissions/\" + governedClass, {headers: headers});\r\n }\r\n}\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\nimport {Directive, Input, TemplateRef, ViewContainerRef, isDevMode} from \"@angular/core\";\r\n\r\nimport {UserService} from \"../user.service\";\r\nimport {UserEntity} from \"../user.entity\";\r\n\r\n/**\r\n * A structural directive for adding and removing elements of the client application based on a users <em>role</em>\r\n * authorization claims.\r\n *\r\n * This directive requires the {@link UserService} as a provider.\r\n *\r\n * @since 1.0.0\r\n */\r\n@Directive({\r\n selector: \"[hciHasRole]\",\r\n providers: [UserService]\r\n})\r\nexport class RoleCheckDirective {\r\n protected _lastCheck: boolean = null;\r\n\r\n constructor(protected _viewContainer: ViewContainerRef,\r\n protected _templateRef: TemplateRef<Object>,\r\n protected _usrSvc: UserService) {\r\n }\r\n\r\n /**\r\n * Calculates the availability of a decorated element based on the authenticated users available roles.\r\n *\r\n * @param roleName for the role required to make the decorated element available\r\n */\r\n @Input()\r\n set hciHasRole(roleName: string) {\r\n if (isDevMode() && <any>console && <any>console.debug) {\r\n console.debug(\"hciHasRole\");\r\n }\r\n\r\n this._usrSvc.getAuthenticatedUser().subscribe((authUser: UserEntity) => {\r\n let found: boolean;\r\n\r\n if (authUser && authUser.Roles) {\r\n found = authUser.Roles.some((role) => {\r\n return role.RoleName === roleName;\r\n });\r\n } else {\r\n found = false;\r\n }\r\n\r\n if (found && (this._lastCheck === null || !this._lastCheck)) {\r\n this._viewContainer.createEmbeddedView(this._templateRef);\r\n } else if (!found && (this._lastCheck === null || this._lastCheck)) {\r\n this._viewContainer.clear();\r\n }\r\n }, (error) => {\r\n // TODO: BHY (08/19/16) - Determine requirements around errors and then REMOVE CONSOLE LOGGING. Display to user,\r\n // log to external source, gobble?\r\n // Gobble up the error.\r\n });\r\n }\r\n}\r\n\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\nimport {Directive, Input, ViewContainerRef, TemplateRef} from \"@angular/core\";\r\nimport {RoleCheckDirective} from \"./role-check.directive\";\r\nimport {UserService} from \"../user.service\";\r\n\r\n/**\r\n * An extension of the {@link RoleCheckDirective} the only evaluates the role if is it not null or undefined.\r\n *\r\n * This directive requires the {@link UserService} as a provider.\r\n *\r\n * @since 1.0.0\r\n */\r\n@Directive({\r\n selector: \"[hciHasRoleUnlessNull]\"\r\n})\r\nexport class RoleCheckUnlessNullDirective extends RoleCheckDirective {\r\n\r\n private _context: HciHasRoleUnlessNullContext = new HciHasRoleUnlessNullContext();\r\n\r\n constructor(\r\n _viewContainer: ViewContainerRef,\r\n _templateRef: TemplateRef<Object>,\r\n _usrSvc: UserService) {\r\n super(_viewContainer, _templateRef, _usrSvc);\r\n }\r\n\r\n @Input()\r\n set hciHasRoleUnlessNull(roleName: string) {\r\n if (!roleName) {\r\n // if the roleName is undefined or null then render\r\n if (this._context._condition !== true) {\r\n this._context._condition = true;\r\n this._updateView();\r\n }\r\n } else {\r\n // otherwise delegate the check to RoleCheckDirective\r\n this.hciHasRole = roleName;\r\n }\r\n }\r\n\r\n private _updateView() {\r\n this._viewContainer.clear();\r\n if (this._context._condition) {\r\n this._viewContainer.createEmbeddedView(this._templateRef, this._context);\r\n } else {\r\n this._viewContainer.createEmbeddedView(this._templateRef, this._context);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * I totally ripped off *ngIf source to get this to work correctly to prevent infinit loop rendering.\r\n */\r\nexport class HciHasRoleUnlessNullContext {\r\n public _condition: boolean = false;\r\n}\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\nimport {ModuleWithProviders, NgModule} from \"@angular/core\";\r\nimport {CommonModule} from \"@angular/common\";\r\nimport {ReactiveFormsModule, FormsModule} from \"@angular/forms\";\r\n\r\nimport {UserService} from \"./user.service\";\r\nimport {RoleCheckDirective} from \"./authorization/role-check.directive\";\r\nimport {RoleCheckUnlessNullDirective} from \"./authorization/role-check-unless-null.directive\";\r\n\r\n/**\r\n * A feature module for user related services, directives, pipes, etc...\r\n *\r\n * @since 1.0.0\r\n */\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n ReactiveFormsModule,\r\n FormsModule\r\n ],\r\n declarations: [\r\n RoleCheckDirective,\r\n RoleCheckUnlessNullDirective\r\n ],\r\n exports: [\r\n RoleCheckDirective,\r\n RoleCheckUnlessNullDirective\r\n ]\r\n})\r\nexport class UserModule {\r\n static forRoot(): ModuleWithProviders<UserModule> {\r\n return {\r\n providers: [\r\n UserService\r\n ],\r\n ngModule: UserModule\r\n };\r\n }\r\n}\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\n\r\n/**\r\n * A barrel file for the HCI ng2 user package.\r\n *\r\n * @since 1.0.0\r\n */\r\nexport {UserModule} from \"./user.module\"\r\nexport {UserEntity} from \"./user.entity\"\r\nexport {RoleEntity} from \"./authorization/role.entity\"\r\nexport {PermissionEntity} from \"./authorization/permission.entity\"\r\n\r\n/**\r\n * The opaque tokens for service configuration.\r\n */\r\nexport {\r\n AUTHENTICATED_USER_ENDPOINT\r\n} from \"./user.service\"\r\n\r\nexport {UserService} from \"./user.service\"\r\n\r\nexport {RoleCheckDirective} from \"./authorization/role-check.directive\";\r\nexport {RoleCheckUnlessNullDirective} from \"./authorization/role-check-unless-null.directive\";\r\n\r\n","/**\n * Generated bundle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A,CAAA;;;AC9BD;;AAEG;AAEH;;;;AAIG;;ACRH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"huntsman-cancer-institute-user.mjs","sources":["../../../projects/user/src/user.entity.ts","../../../projects/user/src/authorization/role.entity.ts","../../../projects/user/src/authorization/permission.entity.ts","../../../projects/user/src/user.service.ts","../../../projects/user/src/authorization/role-check.directive.ts","../../../projects/user/src/authorization/role-check-unless-null.directive.ts","../../../projects/user/src/user.module.ts","../../../projects/user/src/index.ts","../../../projects/user/src/huntsman-cancer-institute-user.ts"],"sourcesContent":["/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\nimport {RoleEntity} from \"./authorization/role.entity\";\r\n\r\n/**\r\n * An immutable representation of an HCI user entity.\r\n *\r\n * @since 1.0.0\r\n */\r\nexport class UserEntity {\r\n constructor(private id: string,\r\n private username: string,\r\n private roles?: RoleEntity[],\r\n private firstname?: string,\r\n private lastname?: string,\r\n private href?: string) {\r\n }\r\n\r\n /**\r\n * An accessor for the users system id.\r\n *\r\n * @returns {string} the system id\r\n * @constructor\r\n */\r\n get Id(): string {\r\n return this.id;\r\n }\r\n\r\n /**\r\n * An accessor for the users application identifier/username.\r\n *\r\n * @returns {string} the application id/username\r\n * @constructor\r\n */\r\n get Username(): string {\r\n return this.username;\r\n }\r\n\r\n /**\r\n * An accessor for the users assigned role authorization claims.\r\n *\r\n * @returns {@code RoleEntity[]} the role authorization claims\r\n * @constructor\r\n */\r\n get Roles(): RoleEntity[] {\r\n return this.roles;\r\n }\r\n\r\n /**\r\n * An accessor for the users firstname.\r\n *\r\n * @return {string} the firstname\r\n * @constructor\r\n */\r\n get Firstname(): string {\r\n return this.firstname;\r\n }\r\n\r\n /**\r\n * A accessor for the users lastname.\r\n *\r\n * @return {string} the lastname\r\n * @constructor\r\n */\r\n get Lastname(): string {\r\n return this.lastname;\r\n }\r\n\r\n /**\r\n * A access for the users fully qualified href location on the system.\r\n *\r\n * @return {string} the href location\r\n * @constructor\r\n */\r\n get Href(): string {\r\n return this.href;\r\n }\r\n\r\n}\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\nimport {PermissionEntity} from \"./permission.entity\";\r\n\r\n/**\r\n * An immutable representation of an HCI role entity, which represents an authorization claim associated with an authenticated\r\n * subject.\r\n *\r\n * @since 1.0.0\r\n */\r\nexport class RoleEntity {\r\n constructor( private roleName: string, private permissions?: PermissionEntity[]) {}\r\n\r\n /**\r\n * An accessor for the name of this role.\r\n *\r\n * @returns {string} the role name\r\n * @constructor\r\n */\r\n get RoleName(): string {\r\n return this.roleName;\r\n }\r\n\r\n /**\r\n * An accessor for a collection of {@link PermissionEntity} authorization claims that define this role. Permissions\r\n * provide a finer grained authorization claim description and are not required.\r\n *\r\n * @returns {PermissionEntity[]} a collection of permission entities\r\n * @constructor\r\n */\r\n get Permissions(): PermissionEntity[] {\r\n return this.permissions;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\n/**\r\n * An immutable representation of an HCI permission entity, which represents a fine grained authorization claim that can\r\n * define a {@link RoleEntity}.\r\n *\r\n * @since 1.0.0\r\n */\r\nexport class PermissionEntity {\r\n constructor(private domain: string, private actions?: string[], private instances?: string[]) {\r\n }\r\n\r\n /**\r\n * An accessor for the domain this permission is defined for (i.e. user, study, specimen, etc...).\r\n *\r\n * @returns {string} the domain of this permission\r\n * @constructor\r\n */\r\n get Domain(): string {\r\n return this.domain;\r\n }\r\n\r\n /**\r\n * An accessor for the actions that this permission allows in the specified domain (i.e. create, read, activate, manage\r\n * etc...). If no actions are defined, this permission claims access to all actions of the specified domain.\r\n *\r\n * @returns {string[]} an array of actions for the specified domain\r\n * @constructor\r\n */\r\n get Actions(): string[] {\r\n return this.actions;\r\n }\r\n\r\n /**\r\n * An accessor for the instances that this permission is applicable to in the specified domain (i.e. joe, 1234, study-foo,\r\n * etc...). If no instances are defined, this permission claims applicability to all instances of the specified domain.\r\n * @returns {string[]}\r\n * @constructor\r\n */\r\n get Instances(): string[] {\r\n return this.instances;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\nimport {Injectable, InjectionToken, Inject, isDevMode} from \"@angular/core\";\r\nimport {HttpClient, HttpResponse, HttpHeaders} from \"@angular/common/http\";\r\n\r\nimport {Observable, of, throwError} from \"rxjs\";\r\nimport {catchError, map} from \"rxjs/operators\";\r\n\r\nimport {UserEntity} from \"./user.entity\";\r\nimport {RoleEntity} from \"./authorization/role.entity\";\r\nimport {PermissionEntity} from \"./authorization/permission.entity\";\r\n\r\nexport let AUTHENTICATED_USER_ENDPOINT = new InjectionToken<string>(\"authenticated_user_url\");\r\n\r\n/**\r\n * @since 1.0.0\r\n */\r\n@Injectable()\r\nexport class UserService {\r\n /**\r\n * The generic error message used when a server error is thrown without a status.\r\n *\r\n * @type {string}\r\n */\r\n public static GENERIC_ERR_MSG: string = \"Server error\";\r\n\r\n private _authenticatedUser: UserEntity = null;\r\n\r\n constructor(private _http: HttpClient, @Inject(AUTHENTICATED_USER_ENDPOINT) private _authenticationUserEndpoint: string) {}\r\n\r\n /**\r\n * An accessor for an {@code Observable<UserEntity>} reflecting the currently authenticated user. If no subject is\r\n * available, the appropriate response status should be returned from the server to indicate that condition\r\n * (i.e. 404 - Not Found).\r\n *\r\n * @returns {Observable<UserEntity>} the currently authenticated user representation\r\n */\r\n public getAuthenticatedUser(): Observable<UserEntity> {\r\n if (isDevMode() && <any>console && <any>console.debug) {\r\n console.debug(\"getAuthenticatedUser\");\r\n }\r\n\r\n if (!this._authenticatedUser) {\r\n if (isDevMode() && <any>console && <any>console.debug) {\r\n console.debug(\"_authenticationUserEndpoint: \" + this._authenticationUserEndpoint);\r\n }\r\n\r\n return this._http.get(this._authenticationUserEndpoint, { observe: \"response\" }).pipe(map((resp: HttpResponse<any>) => {\r\n if (resp.status === 200) {\r\n this._authenticatedUser = this.buildUserEntity(resp.body);\r\n return this._authenticatedUser;\r\n } else {\r\n throw new Error(\"Get authenticated user failed. \" + resp.status + \": \" + resp.statusText);\r\n }\r\n }),\r\n catchError(this.handleError));\r\n } else {\r\n return of(this._authenticatedUser);\r\n }\r\n }\r\n\r\n private handleError(error: any) {\r\n let errMsg = (error.message) ? error.message : UserService.GENERIC_ERR_MSG;\r\n \r\n return throwError(() => new Error(errMsg));\r\n }\r\n\r\n /**\r\n * TODO: Add in a deserializer into the entity.\r\n *\r\n * @param userJson\r\n * @returns {UserEntity}\r\n */\r\n private buildUserEntity(userJson: any): UserEntity {\r\n let roles: RoleEntity[] = [];\r\n if (userJson.roles) {\r\n userJson.roles.map((role: any) => {\r\n let permissions: PermissionEntity[];\r\n if (role.permissions) {\r\n /* TODO: JEH (10/27/16) - Revisit when we determine how permission are communicated to the client, if necessary */\r\n permissions = role.permissions.map((permission: any) => {\r\n return new PermissionEntity(permission.domain, permission.actions, permission.instances);\r\n });\r\n }\r\n roles.push(new RoleEntity(role.roleName, permissions));\r\n });\r\n }\r\n\r\n return new UserEntity(userJson.idUser, userJson.username, roles, userJson.firstname, userJson.lastname, userJson.href);\r\n }\r\n \r\n public getPermissions(governorClass: string, governorId: number, governedClass: string): Observable<any> {\r\n let headers = new HttpHeaders()\r\n .set(\"SecurityGovernorClass\", governorClass).set(\"SecurityGovernorId\", String(governorId));\r\n return this._http.get(\"/core/api/user/permissions/\" + governedClass, {headers: headers});\r\n }\r\n}\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\nimport {Directive, Input, TemplateRef, ViewContainerRef, isDevMode} from \"@angular/core\";\r\n\r\nimport {UserService} from \"../user.service\";\r\nimport {UserEntity} from \"../user.entity\";\r\n\r\n/**\r\n * A structural directive for adding and removing elements of the client application based on a users <em>role</em>\r\n * authorization claims.\r\n *\r\n * This directive requires the {@link UserService} as a provider.\r\n *\r\n * @since 1.0.0\r\n */\r\n@Directive({\r\n selector: \"[hciHasRole]\",\r\n providers: [UserService]\r\n})\r\nexport class RoleCheckDirective {\r\n protected _lastCheck: boolean = null;\r\n\r\n constructor(protected _viewContainer: ViewContainerRef,\r\n protected _templateRef: TemplateRef<Object>,\r\n protected _usrSvc: UserService) {\r\n }\r\n\r\n /**\r\n * Calculates the availability of a decorated element based on the authenticated users available roles.\r\n *\r\n * @param roleName for the role required to make the decorated element available\r\n */\r\n @Input()\r\n set hciHasRole(roleName: string) {\r\n if (isDevMode() && <any>console && <any>console.debug) {\r\n console.debug(\"hciHasRole\");\r\n }\r\n\r\n this._usrSvc.getAuthenticatedUser().subscribe((authUser: UserEntity) => {\r\n let found: boolean;\r\n\r\n if (authUser && authUser.Roles) {\r\n found = authUser.Roles.some((role) => {\r\n return role.RoleName === roleName;\r\n });\r\n } else {\r\n found = false;\r\n }\r\n\r\n if (found && (this._lastCheck === null || !this._lastCheck)) {\r\n this._viewContainer.createEmbeddedView(this._templateRef);\r\n } else if (!found && (this._lastCheck === null || this._lastCheck)) {\r\n this._viewContainer.clear();\r\n }\r\n }, (error) => {\r\n // TODO: BHY (08/19/16) - Determine requirements around errors and then REMOVE CONSOLE LOGGING. Display to user,\r\n // log to external source, gobble?\r\n // Gobble up the error.\r\n });\r\n }\r\n}\r\n\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\nimport {Directive, Input, ViewContainerRef, TemplateRef} from \"@angular/core\";\r\nimport {RoleCheckDirective} from \"./role-check.directive\";\r\nimport {UserService} from \"../user.service\";\r\n\r\n/**\r\n * An extension of the {@link RoleCheckDirective} the only evaluates the role if is it not null or undefined.\r\n *\r\n * This directive requires the {@link UserService} as a provider.\r\n *\r\n * @since 1.0.0\r\n */\r\n@Directive({\r\n selector: \"[hciHasRoleUnlessNull]\"\r\n})\r\nexport class RoleCheckUnlessNullDirective extends RoleCheckDirective {\r\n\r\n private _context: HciHasRoleUnlessNullContext = new HciHasRoleUnlessNullContext();\r\n\r\n constructor(\r\n _viewContainer: ViewContainerRef,\r\n _templateRef: TemplateRef<Object>,\r\n _usrSvc: UserService) {\r\n super(_viewContainer, _templateRef, _usrSvc);\r\n }\r\n\r\n @Input()\r\n set hciHasRoleUnlessNull(roleName: string) {\r\n if (!roleName) {\r\n // if the roleName is undefined or null then render\r\n if (this._context._condition !== true) {\r\n this._context._condition = true;\r\n this._updateView();\r\n }\r\n } else {\r\n // otherwise delegate the check to RoleCheckDirective\r\n this.hciHasRole = roleName;\r\n }\r\n }\r\n\r\n private _updateView() {\r\n this._viewContainer.clear();\r\n if (this._context._condition) {\r\n this._viewContainer.createEmbeddedView(this._templateRef, this._context);\r\n } else {\r\n this._viewContainer.createEmbeddedView(this._templateRef, this._context);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * I totally ripped off *ngIf source to get this to work correctly to prevent infinit loop rendering.\r\n */\r\nexport class HciHasRoleUnlessNullContext {\r\n public _condition: boolean = false;\r\n}\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\nimport {ModuleWithProviders, NgModule} from \"@angular/core\";\r\nimport {CommonModule} from \"@angular/common\";\r\nimport {ReactiveFormsModule, FormsModule} from \"@angular/forms\";\r\n\r\nimport {UserService} from \"./user.service\";\r\nimport {RoleCheckDirective} from \"./authorization/role-check.directive\";\r\nimport {RoleCheckUnlessNullDirective} from \"./authorization/role-check-unless-null.directive\";\r\n\r\n/**\r\n * A feature module for user related services, directives, pipes, etc...\r\n *\r\n * @since 1.0.0\r\n */\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n ReactiveFormsModule,\r\n FormsModule\r\n ],\r\n declarations: [\r\n RoleCheckDirective,\r\n RoleCheckUnlessNullDirective\r\n ],\r\n exports: [\r\n RoleCheckDirective,\r\n RoleCheckUnlessNullDirective\r\n ]\r\n})\r\nexport class UserModule {\r\n static forRoot(): ModuleWithProviders<UserModule> {\r\n return {\r\n providers: [\r\n UserService\r\n ],\r\n ngModule: UserModule\r\n };\r\n }\r\n}\r\n","/*\r\n * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary\r\n */\r\n\r\n/**\r\n * A barrel file for the HCI ng2 user package.\r\n *\r\n * @since 1.0.0\r\n */\r\nexport {UserModule} from \"./user.module\"\r\nexport {UserEntity} from \"./user.entity\"\r\nexport {RoleEntity} from \"./authorization/role.entity\"\r\nexport {PermissionEntity} from \"./authorization/permission.entity\"\r\n\r\n/**\r\n * The opaque tokens for service configuration.\r\n */\r\nexport {\r\n AUTHENTICATED_USER_ENDPOINT\r\n} from \"./user.service\"\r\n\r\nexport {UserService} from \"./user.service\"\r\n\r\nexport {RoleCheckDirective} from \"./authorization/role-check.directive\";\r\nexport {RoleCheckUnlessNullDirective} from \"./authorization/role-check-unless-null.directive\";\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.UserService"],"mappings":";;;;;;;;;AAKA;;;;AAIG;MACU,UAAU,CAAA;IACrB,WAAoB,CAAA,EAAU,EACV,QAAgB,EAChB,KAAoB,EACpB,SAAkB,EAClB,QAAiB,EACjB,IAAa,EAAA;QALb,IAAE,CAAA,EAAA,GAAF,EAAE,CAAQ;QACV,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAQ;QAChB,IAAK,CAAA,KAAA,GAAL,KAAK,CAAe;QACpB,IAAS,CAAA,SAAA,GAAT,SAAS,CAAS;QAClB,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAS;QACjB,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAS;KAChC;AAED;;;;;AAKG;AACH,IAAA,IAAI,EAAE,GAAA;QACJ,OAAO,IAAI,CAAC,EAAE,CAAC;KAChB;AAED;;;;;AAKG;AACH,IAAA,IAAI,QAAQ,GAAA;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;KACtB;AAED;;;;;AA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A,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,YAbnB,YAAY;YACZ,mBAAmB;YACnB,WAAW,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAWF,UAAU,EAAA,UAAA,EAAA,CAAA;kBAftB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBACnB,WAAW;AACZ,qBAAA;AACD,oBAAA,YAAY,EAAE;wBACZ,kBAAkB;wBAClB,4BAA4B;AAC7B,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,kBAAkB;wBAClB,4BAA4B;AAC7B,qBAAA;AACF,iBAAA,CAAA;;;AC9BD;;AAEG;AAEH;;;;AAIG;;ACRH;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A barrel file for the HCI ng2 user package.
|
|
3
|
-
*
|
|
4
|
-
* @since 1.0.0
|
|
5
|
-
*/
|
|
6
|
-
export { UserModule } from "./user.module";
|
|
7
|
-
export { UserEntity } from "./user.entity";
|
|
8
|
-
export { RoleEntity } from "./authorization/role.entity";
|
|
9
|
-
export { PermissionEntity } from "./authorization/permission.entity";
|
|
10
|
-
/**
|
|
11
|
-
* The opaque tokens for service configuration.
|
|
12
|
-
*/
|
|
13
|
-
export { AUTHENTICATED_USER_ENDPOINT } from "./user.service";
|
|
14
|
-
export { UserService } from "./user.service";
|
|
15
|
-
export { RoleCheckDirective } from "./authorization/role-check.directive";
|
|
16
|
-
export { RoleCheckUnlessNullDirective } from "./authorization/role-check-unless-null.directive";
|
|
1
|
+
/**
|
|
2
|
+
* A barrel file for the HCI ng2 user package.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
export { UserModule } from "./user.module";
|
|
7
|
+
export { UserEntity } from "./user.entity";
|
|
8
|
+
export { RoleEntity } from "./authorization/role.entity";
|
|
9
|
+
export { PermissionEntity } from "./authorization/permission.entity";
|
|
10
|
+
/**
|
|
11
|
+
* The opaque tokens for service configuration.
|
|
12
|
+
*/
|
|
13
|
+
export { AUTHENTICATED_USER_ENDPOINT } from "./user.service";
|
|
14
|
+
export { UserService } from "./user.service";
|
|
15
|
+
export { RoleCheckDirective } from "./authorization/role-check.directive";
|
|
16
|
+
export { RoleCheckUnlessNullDirective } from "./authorization/role-check-unless-null.directive";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huntsman-cancer-institute/user",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git@gitlab.com:huntsman-cancer-institute/risr/ng/hci-ng-lib.git"
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@angular/common": "^
|
|
14
|
-
"@angular/core": "^
|
|
13
|
+
"@angular/common": "^17.x",
|
|
14
|
+
"@angular/core": "^17.x"
|
|
15
15
|
},
|
|
16
16
|
"module": "fesm2022/huntsman-cancer-institute-user.mjs",
|
|
17
17
|
"typings": "index.d.ts",
|
package/user.entity.d.ts
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { RoleEntity } from "./authorization/role.entity";
|
|
2
|
-
/**
|
|
3
|
-
* An immutable representation of an HCI user entity.
|
|
4
|
-
*
|
|
5
|
-
* @since 1.0.0
|
|
6
|
-
*/
|
|
7
|
-
export declare class UserEntity {
|
|
8
|
-
private id;
|
|
9
|
-
private username;
|
|
10
|
-
private roles?;
|
|
11
|
-
private firstname?;
|
|
12
|
-
private lastname?;
|
|
13
|
-
private href?;
|
|
14
|
-
constructor(id: string, username: string, roles?: RoleEntity[], firstname?: string, lastname?: string, href?: string);
|
|
15
|
-
/**
|
|
16
|
-
* An accessor for the users system id.
|
|
17
|
-
*
|
|
18
|
-
* @returns {string} the system id
|
|
19
|
-
* @constructor
|
|
20
|
-
*/
|
|
21
|
-
get Id(): string;
|
|
22
|
-
/**
|
|
23
|
-
* An accessor for the users application identifier/username.
|
|
24
|
-
*
|
|
25
|
-
* @returns {string} the application id/username
|
|
26
|
-
* @constructor
|
|
27
|
-
*/
|
|
28
|
-
get Username(): string;
|
|
29
|
-
/**
|
|
30
|
-
* An accessor for the users assigned role authorization claims.
|
|
31
|
-
*
|
|
32
|
-
* @returns {@code RoleEntity[]} the role authorization claims
|
|
33
|
-
* @constructor
|
|
34
|
-
*/
|
|
35
|
-
get Roles(): RoleEntity[];
|
|
36
|
-
/**
|
|
37
|
-
* An accessor for the users firstname.
|
|
38
|
-
*
|
|
39
|
-
* @return {string} the firstname
|
|
40
|
-
* @constructor
|
|
41
|
-
*/
|
|
42
|
-
get Firstname(): string;
|
|
43
|
-
/**
|
|
44
|
-
* A accessor for the users lastname.
|
|
45
|
-
*
|
|
46
|
-
* @return {string} the lastname
|
|
47
|
-
* @constructor
|
|
48
|
-
*/
|
|
49
|
-
get Lastname(): string;
|
|
50
|
-
/**
|
|
51
|
-
* A access for the users fully qualified href location on the system.
|
|
52
|
-
*
|
|
53
|
-
* @return {string} the href location
|
|
54
|
-
* @constructor
|
|
55
|
-
*/
|
|
56
|
-
get Href(): string;
|
|
57
|
-
}
|
|
1
|
+
import { RoleEntity } from "./authorization/role.entity";
|
|
2
|
+
/**
|
|
3
|
+
* An immutable representation of an HCI user entity.
|
|
4
|
+
*
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
export declare class UserEntity {
|
|
8
|
+
private id;
|
|
9
|
+
private username;
|
|
10
|
+
private roles?;
|
|
11
|
+
private firstname?;
|
|
12
|
+
private lastname?;
|
|
13
|
+
private href?;
|
|
14
|
+
constructor(id: string, username: string, roles?: RoleEntity[], firstname?: string, lastname?: string, href?: string);
|
|
15
|
+
/**
|
|
16
|
+
* An accessor for the users system id.
|
|
17
|
+
*
|
|
18
|
+
* @returns {string} the system id
|
|
19
|
+
* @constructor
|
|
20
|
+
*/
|
|
21
|
+
get Id(): string;
|
|
22
|
+
/**
|
|
23
|
+
* An accessor for the users application identifier/username.
|
|
24
|
+
*
|
|
25
|
+
* @returns {string} the application id/username
|
|
26
|
+
* @constructor
|
|
27
|
+
*/
|
|
28
|
+
get Username(): string;
|
|
29
|
+
/**
|
|
30
|
+
* An accessor for the users assigned role authorization claims.
|
|
31
|
+
*
|
|
32
|
+
* @returns {@code RoleEntity[]} the role authorization claims
|
|
33
|
+
* @constructor
|
|
34
|
+
*/
|
|
35
|
+
get Roles(): RoleEntity[];
|
|
36
|
+
/**
|
|
37
|
+
* An accessor for the users firstname.
|
|
38
|
+
*
|
|
39
|
+
* @return {string} the firstname
|
|
40
|
+
* @constructor
|
|
41
|
+
*/
|
|
42
|
+
get Firstname(): string;
|
|
43
|
+
/**
|
|
44
|
+
* A accessor for the users lastname.
|
|
45
|
+
*
|
|
46
|
+
* @return {string} the lastname
|
|
47
|
+
* @constructor
|
|
48
|
+
*/
|
|
49
|
+
get Lastname(): string;
|
|
50
|
+
/**
|
|
51
|
+
* A access for the users fully qualified href location on the system.
|
|
52
|
+
*
|
|
53
|
+
* @return {string} the href location
|
|
54
|
+
* @constructor
|
|
55
|
+
*/
|
|
56
|
+
get Href(): string;
|
|
57
|
+
}
|
package/user.module.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ModuleWithProviders } from "@angular/core";
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
import * as i1 from "./authorization/role-check.directive";
|
|
4
|
-
import * as i2 from "./authorization/role-check-unless-null.directive";
|
|
5
|
-
import * as i3 from "@angular/common";
|
|
6
|
-
import * as i4 from "@angular/forms";
|
|
7
|
-
/**
|
|
8
|
-
* A feature module for user related services, directives, pipes, etc...
|
|
9
|
-
*
|
|
10
|
-
* @since 1.0.0
|
|
11
|
-
*/
|
|
12
|
-
export declare class UserModule {
|
|
13
|
-
static forRoot(): ModuleWithProviders<UserModule>;
|
|
14
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<UserModule, never>;
|
|
15
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<UserModule, [typeof i1.RoleCheckDirective, typeof i2.RoleCheckUnlessNullDirective], [typeof i3.CommonModule, typeof i4.ReactiveFormsModule, typeof i4.FormsModule], [typeof i1.RoleCheckDirective, typeof i2.RoleCheckUnlessNullDirective]>;
|
|
16
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<UserModule>;
|
|
17
|
-
}
|
|
1
|
+
import { ModuleWithProviders } from "@angular/core";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import * as i1 from "./authorization/role-check.directive";
|
|
4
|
+
import * as i2 from "./authorization/role-check-unless-null.directive";
|
|
5
|
+
import * as i3 from "@angular/common";
|
|
6
|
+
import * as i4 from "@angular/forms";
|
|
7
|
+
/**
|
|
8
|
+
* A feature module for user related services, directives, pipes, etc...
|
|
9
|
+
*
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
*/
|
|
12
|
+
export declare class UserModule {
|
|
13
|
+
static forRoot(): ModuleWithProviders<UserModule>;
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UserModule, never>;
|
|
15
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<UserModule, [typeof i1.RoleCheckDirective, typeof i2.RoleCheckUnlessNullDirective], [typeof i3.CommonModule, typeof i4.ReactiveFormsModule, typeof i4.FormsModule], [typeof i1.RoleCheckDirective, typeof i2.RoleCheckUnlessNullDirective]>;
|
|
16
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<UserModule>;
|
|
17
|
+
}
|
package/user.service.d.ts
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { InjectionToken } from "@angular/core";
|
|
2
|
-
import { HttpClient } from "@angular/common/http";
|
|
3
|
-
import { Observable } from "rxjs";
|
|
4
|
-
import { UserEntity } from "./user.entity";
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
export declare let AUTHENTICATED_USER_ENDPOINT: InjectionToken<string>;
|
|
7
|
-
/**
|
|
8
|
-
* @since 1.0.0
|
|
9
|
-
*/
|
|
10
|
-
export declare class UserService {
|
|
11
|
-
private _http;
|
|
12
|
-
private _authenticationUserEndpoint;
|
|
13
|
-
/**
|
|
14
|
-
* The generic error message used when a server error is thrown without a status.
|
|
15
|
-
*
|
|
16
|
-
* @type {string}
|
|
17
|
-
*/
|
|
18
|
-
static GENERIC_ERR_MSG: string;
|
|
19
|
-
private _authenticatedUser;
|
|
20
|
-
constructor(_http: HttpClient, _authenticationUserEndpoint: string);
|
|
21
|
-
/**
|
|
22
|
-
* An accessor for an {@code Observable<UserEntity>} reflecting the currently authenticated user. If no subject is
|
|
23
|
-
* available, the appropriate response status should be returned from the server to indicate that condition
|
|
24
|
-
* (i.e. 404 - Not Found).
|
|
25
|
-
*
|
|
26
|
-
* @returns {Observable<UserEntity>} the currently authenticated user representation
|
|
27
|
-
*/
|
|
28
|
-
getAuthenticatedUser(): Observable<UserEntity>;
|
|
29
|
-
private handleError;
|
|
30
|
-
/**
|
|
31
|
-
* TODO: Add in a deserializer into the entity.
|
|
32
|
-
*
|
|
33
|
-
* @param userJson
|
|
34
|
-
* @returns {UserEntity}
|
|
35
|
-
*/
|
|
36
|
-
private buildUserEntity;
|
|
37
|
-
getPermissions(governorClass: string, governorId: number, governedClass: string): Observable<any>;
|
|
38
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<UserService, never>;
|
|
39
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<UserService>;
|
|
40
|
-
}
|
|
1
|
+
import { InjectionToken } from "@angular/core";
|
|
2
|
+
import { HttpClient } from "@angular/common/http";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
import { UserEntity } from "./user.entity";
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare let AUTHENTICATED_USER_ENDPOINT: InjectionToken<string>;
|
|
7
|
+
/**
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
export declare class UserService {
|
|
11
|
+
private _http;
|
|
12
|
+
private _authenticationUserEndpoint;
|
|
13
|
+
/**
|
|
14
|
+
* The generic error message used when a server error is thrown without a status.
|
|
15
|
+
*
|
|
16
|
+
* @type {string}
|
|
17
|
+
*/
|
|
18
|
+
static GENERIC_ERR_MSG: string;
|
|
19
|
+
private _authenticatedUser;
|
|
20
|
+
constructor(_http: HttpClient, _authenticationUserEndpoint: string);
|
|
21
|
+
/**
|
|
22
|
+
* An accessor for an {@code Observable<UserEntity>} reflecting the currently authenticated user. If no subject is
|
|
23
|
+
* available, the appropriate response status should be returned from the server to indicate that condition
|
|
24
|
+
* (i.e. 404 - Not Found).
|
|
25
|
+
*
|
|
26
|
+
* @returns {Observable<UserEntity>} the currently authenticated user representation
|
|
27
|
+
*/
|
|
28
|
+
getAuthenticatedUser(): Observable<UserEntity>;
|
|
29
|
+
private handleError;
|
|
30
|
+
/**
|
|
31
|
+
* TODO: Add in a deserializer into the entity.
|
|
32
|
+
*
|
|
33
|
+
* @param userJson
|
|
34
|
+
* @returns {UserEntity}
|
|
35
|
+
*/
|
|
36
|
+
private buildUserEntity;
|
|
37
|
+
getPermissions(governorClass: string, governorId: number, governedClass: string): Observable<any>;
|
|
38
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UserService, never>;
|
|
39
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<UserService>;
|
|
40
|
+
}
|