@huntsman-cancer-institute/user 8.0.0
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/README.md +74 -0
- package/index.d.ts +16 -0
- package/index.js +20 -0
- package/index.js.map +1 -0
- package/index.metadata.json +1 -0
- package/package.json +88 -0
- package/src/authorization/permission.entity.d.ts +34 -0
- package/src/authorization/permission.entity.js +45 -0
- package/src/authorization/permission.entity.js.map +1 -0
- package/src/authorization/permission.entity.metadata.json +1 -0
- package/src/authorization/role-check-unless-null.directive.d.ts +22 -0
- package/src/authorization/role-check-unless-null.directive.js +73 -0
- package/src/authorization/role-check-unless-null.directive.js.map +1 -0
- package/src/authorization/role-check-unless-null.directive.metadata.json +1 -0
- package/src/authorization/role-check.directive.d.ts +23 -0
- package/src/authorization/role-check.directive.js +77 -0
- package/src/authorization/role-check.directive.js.map +1 -0
- package/src/authorization/role-check.directive.metadata.json +1 -0
- package/src/authorization/role.entity.d.ts +27 -0
- package/src/authorization/role.entity.js +32 -0
- package/src/authorization/role.entity.js.map +1 -0
- package/src/authorization/role.entity.metadata.json +1 -0
- package/src/user.entity.d.ts +57 -0
- package/src/user.entity.js +70 -0
- package/src/user.entity.js.map +1 -0
- package/src/user.entity.metadata.json +1 -0
- package/src/user.module.d.ts +9 -0
- package/src/user.module.js +50 -0
- package/src/user.module.js.map +1 -0
- package/src/user.module.metadata.json +1 -0
- package/src/user.module.ngfactory.d.ts +3 -0
- package/src/user.module.ngfactory.js +13 -0
- package/src/user.module.ngfactory.js.map +1 -0
- package/src/user.service.d.ts +37 -0
- package/src/user.service.js +107 -0
- package/src/user.service.js.map +1 -0
- package/src/user.service.metadata.json +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Angular User Module
|
|
2
|
+
|
|
3
|
+
TODO: Separate out the parts moved to @huntsman-cancer-institute/authentication.
|
|
4
|
+
|
|
5
|
+
This library provides elements for authenticating the user, protecting routes, getting user information from the a server,
|
|
6
|
+
defining that user representation in the client application, directives for controlling the UI based on aspects of the
|
|
7
|
+
user like authorization claims and destroying the user session (logout).
|
|
8
|
+
|
|
9
|
+
A component can be imported directly though the main index.ts barrel file which groups all components in this library for
|
|
10
|
+
easy importing.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
This package provides a configurable service to interact with a server-side REST api. It is designed to be configurable
|
|
15
|
+
through the Angular injection framework and the usage of OpaqueTokens. See the development harnesses application module
|
|
16
|
+
for details or review the jsDocs on the `UserService` class.
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
- Configurable user service for interactions with server-side REST api
|
|
20
|
+
- A route protection service that implements `CanActivate`
|
|
21
|
+
- Immutable entities to represent the user representation in the client application
|
|
22
|
+
- Directive to control the UI based on a users authorization claims (roles, permissions, etc...)
|
|
23
|
+
|
|
24
|
+
### API
|
|
25
|
+
|
|
26
|
+
#### User Service
|
|
27
|
+
The user service is configured through module injection. The tokens that must be defined are:
|
|
28
|
+
- AUTHENTICATED_USER_ENDPOINT: the url to the endpoint for the currently authenticated subject
|
|
29
|
+
- DEFAULT_SUCCESS_URL: the url to navigate the user to after a successful authentication attempt, if another location wasn't declared in the request
|
|
30
|
+
- USER_SESSION_ENDPOINT: a user session endpoint configuration (e.g. https://localhost/core/api/user-session)
|
|
31
|
+
- SERVER_URL: a url to define the base server api, if a variable login/logout api configuration is necessary (e.g. https://localhost/core/api)
|
|
32
|
+
- LOGIN_PATH: a variable path for login that extends SERVER_URL (e.g. /login)
|
|
33
|
+
- LOGOUT_PATH: a variable path for logout that extends SERVER_URL (e.g. /logout)
|
|
34
|
+
|
|
35
|
+
When configuring the user service it must include either USER_SESSION_ENDPOINT or SERVER_URL, LOGIN_PATH and LOGOUT_PATH,
|
|
36
|
+
depending on the type of API to be supported (consistent vs. variable). The service will fail to instantiate if all
|
|
37
|
+
opaque tokens are provided with values other than null. See the UserService jsdocs for details about configuring this aspect
|
|
38
|
+
of the user feature module.
|
|
39
|
+
|
|
40
|
+
##### Login Callbacks
|
|
41
|
+
The user service also supports login success callbacks. Components may add one or more callback functions that are invoked
|
|
42
|
+
in the order they were added upon successful authentication. This is useful when you require something special to happen after
|
|
43
|
+
authentication, but outside of the scope of component initialization and creation.
|
|
44
|
+
|
|
45
|
+
#### Route Guard Service
|
|
46
|
+
A service to enable secured endpoints to force authentication. The tokens that must be defined are:
|
|
47
|
+
- LOGIN_ROUTE: the configured login component path
|
|
48
|
+
|
|
49
|
+
#### User Entities
|
|
50
|
+
The immutable entities defining the representation of a user in the client application that are to be used when marshalling
|
|
51
|
+
the user to and from the server (see JSON.stringify() for an easy approach)
|
|
52
|
+
|
|
53
|
+
**UserEntity:**
|
|
54
|
+
- **id:** the system identifier of the user
|
|
55
|
+
- **username:** the users application identifier
|
|
56
|
+
- **roles:** (optional) a collection of authorization claims optionally defined by finer grained permissions
|
|
57
|
+
|
|
58
|
+
**RoleEntity**
|
|
59
|
+
- **roleName:** the name of the role associated with the server-side subject
|
|
60
|
+
- **permissions:** (optional) a collection of fine grained authorization claims that can defined a role
|
|
61
|
+
|
|
62
|
+
**PermissionEntity**
|
|
63
|
+
- **domain:** the domain a permission is defined for (i.e. user, study, specimen, etc...)
|
|
64
|
+
- **actions:** a string array of actions that this permission allows in the specified domain (i.e. create, read,
|
|
65
|
+
activate, manage etc...). If no actions are defined, this permission claims access to all actions of the specified domain.
|
|
66
|
+
- **instances:** a string array of instances that this permission is applicable to in the specified domain (i.e. joe,
|
|
67
|
+
1234, study-foo, etc...). If no instances are defined, this permission claims applicability to all instances of the
|
|
68
|
+
specified domain.
|
|
69
|
+
|
|
70
|
+
#### Structural Directive for UI Control
|
|
71
|
+
**hciHasRole** directive allows for the decoration of UI elements that should be included or removed from the DOM as dictated
|
|
72
|
+
by a users role authorization claims
|
|
73
|
+
**hciHasRoleUnlessNull** extends the **hciHasRole** directive but will only check the user authorization if the give role
|
|
74
|
+
value is not null or is not undefined.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A barrel file for the HCI ng2 user package.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
export { UserModule } from "./src/user.module";
|
|
7
|
+
export { UserEntity } from "./src/user.entity";
|
|
8
|
+
export { RoleEntity } from "./src/authorization/role.entity";
|
|
9
|
+
export { PermissionEntity } from "./src/authorization/permission.entity";
|
|
10
|
+
/**
|
|
11
|
+
* The opaque tokens for service configuration.
|
|
12
|
+
*/
|
|
13
|
+
export { AUTHENTICATED_USER_ENDPOINT } from "./src/user.service";
|
|
14
|
+
export { UserService } from "./src/user.service";
|
|
15
|
+
export { RoleCheckDirective } from "./src/authorization/role-check.directive";
|
|
16
|
+
export { RoleCheckUnlessNullDirective } from "./src/authorization/role-check-unless-null.directive";
|
package/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* A barrel file for the HCI ng2 user package.
|
|
6
|
+
*
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
*/
|
|
9
|
+
export { UserModule } from "./src/user.module";
|
|
10
|
+
export { UserEntity } from "./src/user.entity";
|
|
11
|
+
export { RoleEntity } from "./src/authorization/role.entity";
|
|
12
|
+
export { PermissionEntity } from "./src/authorization/permission.entity";
|
|
13
|
+
/**
|
|
14
|
+
* The opaque tokens for service configuration.
|
|
15
|
+
*/
|
|
16
|
+
export { AUTHENTICATED_USER_ENDPOINT } from "./src/user.service";
|
|
17
|
+
export { UserService } from "./src/user.service";
|
|
18
|
+
export { RoleCheckDirective } from "./src/authorization/role-check.directive";
|
|
19
|
+
export { RoleCheckUnlessNullDirective } from "./src/authorization/role-check-unless-null.directive";
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAC,UAAU,EAAC,MAAM,iCAAiC,CAAA;AAC1D,OAAO,EAAC,gBAAgB,EAAC,MAAM,uCAAuC,CAAA;AAEtE;;GAEG;AACH,OAAO,EACL,2BAA2B,EAC5B,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EAAC,kBAAkB,EAAC,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAC,4BAA4B,EAAC,MAAM,sDAAsD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./src/user.module","export":["UserModule"]},{"from":"./src/user.entity","export":["UserEntity"]},{"from":"./src/authorization/role.entity","export":["RoleEntity"]},{"from":"./src/authorization/permission.entity","export":["PermissionEntity"]},{"from":"./src/user.service","export":["AUTHENTICATED_USER_ENDPOINT"]},{"from":"./src/user.service","export":["UserService"]},{"from":"./src/authorization/role-check.directive","export":["RoleCheckDirective"]},{"from":"./src/authorization/role-check-unless-null.directive","export":["RoleCheckUnlessNullDirective"]}]}]
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@huntsman-cancer-institute/user",
|
|
3
|
+
"version": "8.0.0",
|
|
4
|
+
"description": "The user library. This component is expected to provide user specific component and services to any HCI ng application",
|
|
5
|
+
"contributors": [
|
|
6
|
+
"Michael Byrne"
|
|
7
|
+
],
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"registry": "https://registry.npmjs.org",
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"repository": "https://gitlab.com/huntsman-cancer-institute/risr/ng/hci-ng.git",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "npm run clean && npm run ngc && npm run doc && npm run karma start && npm run copyfiles package.json dist/",
|
|
15
|
+
"clean": "npm run rimraf dist/ index.js index.d.ts index.ngsummary.json index.metadata.json index.js.map src/**/*.js src/**/*.ngfactory.ts src/**/*.d.ts src/**/*.js.map src/**/*.ngsummary.json src/**/*.metadata.json code-coverage",
|
|
16
|
+
"compodoc": "compodoc",
|
|
17
|
+
"copyfiles": "copyfiles",
|
|
18
|
+
"copyToDist": "npm run copyfiles -- package.json README.md dist/",
|
|
19
|
+
"doc": "npm run compodoc -- src -p ./tsconfig.json -d docs -n '@huntsman-cancer-institute/user'",
|
|
20
|
+
"karma": "karma",
|
|
21
|
+
"ngc": "ngc",
|
|
22
|
+
"npmPack": "npm run build && npm run copyToDist && cd dist && npm pack",
|
|
23
|
+
"npmPublish": "npm run build && npm run copyToDist && cd dist && npm publish",
|
|
24
|
+
"rimraf": "rimraf"
|
|
25
|
+
},
|
|
26
|
+
"main": "index.js",
|
|
27
|
+
"module": "index.js",
|
|
28
|
+
"typings": "index.d.ts",
|
|
29
|
+
"files": [
|
|
30
|
+
"index.+(js|d.ts|js.map|metadata.json)",
|
|
31
|
+
"src/**/!(*spec).+(js|d.ts|js.map|metadata.json)"
|
|
32
|
+
],
|
|
33
|
+
"optionalDependencies": {
|
|
34
|
+
"@huntsman-cancer-institute/authentication": "14.10.0"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@angular/common": "^8.0.0",
|
|
38
|
+
"@angular/core": "^8.0.0",
|
|
39
|
+
"@huntsman-cancer-institute/authentication": "8.0.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@angular/animations": "^8.0.0",
|
|
43
|
+
"@angular/common": "^8.0.0",
|
|
44
|
+
"@angular/compiler": "^8.0.0",
|
|
45
|
+
"@angular/compiler-cli": "^8.0.0",
|
|
46
|
+
"@angular/core": "^8.0.0",
|
|
47
|
+
"@angular/forms": "^8.0.0",
|
|
48
|
+
"@angular/platform-browser": "^8.0.0",
|
|
49
|
+
"@angular/platform-browser-dynamic": "^8.0.0",
|
|
50
|
+
"@angular/router": "^8.0.0",
|
|
51
|
+
"@compodoc/compodoc": "^1.0.0",
|
|
52
|
+
"@huntsman-cancer-institute/authentication": "8.0.0",
|
|
53
|
+
"@types/jasmine": "^2.5.53",
|
|
54
|
+
"@types/node": "^7.0.22",
|
|
55
|
+
"@types/webpack": "4.1.2",
|
|
56
|
+
"angular2-cool-storage": "3.1.5",
|
|
57
|
+
"awesome-typescript-loader": "^3.2.3",
|
|
58
|
+
"angular2-template-loader": "^0.6.2",
|
|
59
|
+
"copyfiles": "^1.2.0",
|
|
60
|
+
"core-js": "^2.4.1",
|
|
61
|
+
"del": "^2.2.1",
|
|
62
|
+
"fs": "^0.0.2",
|
|
63
|
+
"immutable": "^3.8.1",
|
|
64
|
+
"inline-source-map": "^0.6.2",
|
|
65
|
+
"istanbul-instrumenter-loader": "2.0.0",
|
|
66
|
+
"jasmine-core": "^2.6.2",
|
|
67
|
+
"karma": "^1.7.0",
|
|
68
|
+
"karma-chrome-launcher": "^2.1.1",
|
|
69
|
+
"karma-coverage": "^1.1.1",
|
|
70
|
+
"karma-jasmine": "^1.1.0",
|
|
71
|
+
"karma-mocha-reporter": "^2.2.3",
|
|
72
|
+
"karma-remap-coverage": "^0.1.4",
|
|
73
|
+
"karma-sourcemap-loader": "^0.3.7",
|
|
74
|
+
"karma-webpack": "^2.0.3",
|
|
75
|
+
"minimist": "^1.2.0",
|
|
76
|
+
"reflect-metadata": "^0.1.3",
|
|
77
|
+
"rimraf": "^2.6.1",
|
|
78
|
+
"rxjs": "6.4.x",
|
|
79
|
+
"source-map-loader": "^0.2.1",
|
|
80
|
+
"tslint": "^4.5.1",
|
|
81
|
+
"typescript": "~3.4.2",
|
|
82
|
+
"webpack": "3.11.0",
|
|
83
|
+
"webpack-dev-middleware": "1.12.0",
|
|
84
|
+
"webpack-dev-server": "2.7.1",
|
|
85
|
+
"webpack-merge": "4.1.0",
|
|
86
|
+
"zone.js": "^0.9.1"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An immutable representation of an HCI permission entity, which represents a fine grained authorization claim that can
|
|
3
|
+
* define a {@link RoleEntity}.
|
|
4
|
+
*
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
export declare class PermissionEntity {
|
|
8
|
+
private domain;
|
|
9
|
+
private actions?;
|
|
10
|
+
private instances?;
|
|
11
|
+
constructor(domain: string, actions?: string[], instances?: string[]);
|
|
12
|
+
/**
|
|
13
|
+
* An accessor for the domain this permission is defined for (i.e. user, study, specimen, etc...).
|
|
14
|
+
*
|
|
15
|
+
* @returns {string} the domain of this permission
|
|
16
|
+
* @constructor
|
|
17
|
+
*/
|
|
18
|
+
readonly Domain: string;
|
|
19
|
+
/**
|
|
20
|
+
* An accessor for the actions that this permission allows in the specified domain (i.e. create, read, activate, manage
|
|
21
|
+
* etc...). If no actions are defined, this permission claims access to all actions of the specified domain.
|
|
22
|
+
*
|
|
23
|
+
* @returns {string[]} an array of actions for the specified domain
|
|
24
|
+
* @constructor
|
|
25
|
+
*/
|
|
26
|
+
readonly Actions: string[];
|
|
27
|
+
/**
|
|
28
|
+
* An accessor for the instances that this permission is applicable to in the specified domain (i.e. joe, 1234, study-foo,
|
|
29
|
+
* etc...). If no instances are defined, this permission claims applicability to all instances of the specified domain.
|
|
30
|
+
* @returns {string[]}
|
|
31
|
+
* @constructor
|
|
32
|
+
*/
|
|
33
|
+
readonly Instances: string[];
|
|
34
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* An immutable representation of an HCI permission entity, which represents a fine grained authorization claim that can
|
|
6
|
+
* define a {@link RoleEntity}.
|
|
7
|
+
*
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
export class PermissionEntity {
|
|
11
|
+
constructor(domain, actions, instances) {
|
|
12
|
+
this.domain = domain;
|
|
13
|
+
this.actions = actions;
|
|
14
|
+
this.instances = instances;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* An accessor for the domain this permission is defined for (i.e. user, study, specimen, etc...).
|
|
18
|
+
*
|
|
19
|
+
* @returns {string} the domain of this permission
|
|
20
|
+
* @constructor
|
|
21
|
+
*/
|
|
22
|
+
get Domain() {
|
|
23
|
+
return this.domain;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* An accessor for the actions that this permission allows in the specified domain (i.e. create, read, activate, manage
|
|
27
|
+
* etc...). If no actions are defined, this permission claims access to all actions of the specified domain.
|
|
28
|
+
*
|
|
29
|
+
* @returns {string[]} an array of actions for the specified domain
|
|
30
|
+
* @constructor
|
|
31
|
+
*/
|
|
32
|
+
get Actions() {
|
|
33
|
+
return this.actions;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* An accessor for the instances that this permission is applicable to in the specified domain (i.e. joe, 1234, study-foo,
|
|
37
|
+
* etc...). If no instances are defined, this permission claims applicability to all instances of the specified domain.
|
|
38
|
+
* @returns {string[]}
|
|
39
|
+
* @constructor
|
|
40
|
+
*/
|
|
41
|
+
get Instances() {
|
|
42
|
+
return this.instances;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=permission.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission.entity.js","sourceRoot":"","sources":["../../../src/authorization/permission.entity.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;GAKG;AACH,MAAM,OAAO,gBAAgB;IAC3B,YAAoB,MAAc,EAAU,OAAkB,EAAU,SAAoB;QAAxE,WAAM,GAAN,MAAM,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAW;QAAU,cAAS,GAAT,SAAS,CAAW;IAC5F,CAAC;IAED;;;;;OAKG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;;OAMG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"PermissionEntity":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"string"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"string"}]}]}]}}}}]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ViewContainerRef, TemplateRef } from "@angular/core";
|
|
2
|
+
import { RoleCheckDirective } from "./role-check.directive";
|
|
3
|
+
import { UserService } from "../user.service";
|
|
4
|
+
/**
|
|
5
|
+
* An extension of the {@link RoleCheckDirective} the only evaluates the role if is it not null or undefined.
|
|
6
|
+
*
|
|
7
|
+
* This directive requires the {@link UserService} as a provider.
|
|
8
|
+
*
|
|
9
|
+
* @since 1.0.0
|
|
10
|
+
*/
|
|
11
|
+
export declare class RoleCheckUnlessNullDirective extends RoleCheckDirective {
|
|
12
|
+
private _context;
|
|
13
|
+
constructor(_viewContainer: ViewContainerRef, _templateRef: TemplateRef<Object>, _usrSvc: UserService);
|
|
14
|
+
hciHasRoleUnlessNull: string;
|
|
15
|
+
private _updateView;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* I totally ripped off *ngIf source to get this to work correctly to prevent infinit loop rendering.
|
|
19
|
+
*/
|
|
20
|
+
export declare class HciHasRoleUnlessNullContext {
|
|
21
|
+
_condition: boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
/*
|
|
11
|
+
* Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
|
|
12
|
+
*/
|
|
13
|
+
import { Directive, Input, ViewContainerRef, TemplateRef } from "@angular/core";
|
|
14
|
+
import { RoleCheckDirective } from "./role-check.directive";
|
|
15
|
+
import { UserService } from "../user.service";
|
|
16
|
+
/**
|
|
17
|
+
* An extension of the {@link RoleCheckDirective} the only evaluates the role if is it not null or undefined.
|
|
18
|
+
*
|
|
19
|
+
* This directive requires the {@link UserService} as a provider.
|
|
20
|
+
*
|
|
21
|
+
* @since 1.0.0
|
|
22
|
+
*/
|
|
23
|
+
let RoleCheckUnlessNullDirective = class RoleCheckUnlessNullDirective extends RoleCheckDirective {
|
|
24
|
+
constructor(_viewContainer, _templateRef, _usrSvc) {
|
|
25
|
+
super(_viewContainer, _templateRef, _usrSvc);
|
|
26
|
+
this._context = new HciHasRoleUnlessNullContext();
|
|
27
|
+
}
|
|
28
|
+
set hciHasRoleUnlessNull(roleName) {
|
|
29
|
+
if (!roleName) {
|
|
30
|
+
// if the roleName is undefined or null then render
|
|
31
|
+
if (this._context._condition !== true) {
|
|
32
|
+
this._context._condition = true;
|
|
33
|
+
this._updateView();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
// otherwise delegate the check to RoleCheckDirective
|
|
38
|
+
this.hciHasRole = roleName;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
_updateView() {
|
|
42
|
+
this._viewContainer.clear();
|
|
43
|
+
if (this._context._condition) {
|
|
44
|
+
this._viewContainer.createEmbeddedView(this._templateRef, this._context);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this._viewContainer.createEmbeddedView(this._templateRef, this._context);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
__decorate([
|
|
52
|
+
Input(),
|
|
53
|
+
__metadata("design:type", String),
|
|
54
|
+
__metadata("design:paramtypes", [String])
|
|
55
|
+
], RoleCheckUnlessNullDirective.prototype, "hciHasRoleUnlessNull", null);
|
|
56
|
+
RoleCheckUnlessNullDirective = __decorate([
|
|
57
|
+
Directive({
|
|
58
|
+
selector: "[hciHasRoleUnlessNull]"
|
|
59
|
+
}),
|
|
60
|
+
__metadata("design:paramtypes", [ViewContainerRef,
|
|
61
|
+
TemplateRef,
|
|
62
|
+
UserService])
|
|
63
|
+
], RoleCheckUnlessNullDirective);
|
|
64
|
+
export { RoleCheckUnlessNullDirective };
|
|
65
|
+
/**
|
|
66
|
+
* I totally ripped off *ngIf source to get this to work correctly to prevent infinit loop rendering.
|
|
67
|
+
*/
|
|
68
|
+
export class HciHasRoleUnlessNullContext {
|
|
69
|
+
constructor() {
|
|
70
|
+
this._condition = false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=role-check-unless-null.directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-check-unless-null.directive.js","sourceRoot":"","sources":["../../../src/authorization/role-check-unless-null.directive.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;GAEG;AACH,OAAO,EAAC,SAAS,EAAE,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE5C;;;;;;GAMG;AAIH,IAAa,4BAA4B,GAAzC,MAAa,4BAA6B,SAAQ,kBAAkB;IAIlE,YACE,cAAgC,EAChC,YAAiC,EACjC,OAAoB;QACpB,KAAK,CAAC,cAAc,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QANvC,aAAQ,GAAgC,IAAI,2BAA2B,EAAE,CAAC;IAOlF,CAAC;IAGD,IAAI,oBAAoB,CAAC,QAAgB;QACvC,IAAI,CAAC,QAAQ,EAAE;YACb,mDAAmD;YACnD,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,KAAK,IAAI,EAAE;gBACrC,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC;gBAChC,IAAI,CAAC,WAAW,EAAE,CAAC;aACpB;SACF;aAAM;YACL,qDAAqD;YACrD,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;SAC5B;IACH,CAAC;IAEO,WAAW;QACjB,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE;YAC5B,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC1E;aAAM;YACL,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC1E;IACH,CAAC;CACF,CAAA;AArBC;IADC,KAAK,EAAE;;;wEAYP;AAvBU,4BAA4B;IAHxC,SAAS,CAAC;QACR,QAAQ,EAAE,wBAAwB;KACpC,CAAC;qCAMkB,gBAAgB;QAClB,WAAW;QAChB,WAAW;GAPX,4BAA4B,CAiCxC;SAjCY,4BAA4B;AAmCzC;;GAEG;AACH,MAAM,OAAO,2BAA2B;IAAxC;QACS,eAAU,GAAY,KAAK,CAAC;IACrC,CAAC;CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"RoleCheckUnlessNullDirective":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./role-check.directive","name":"RoleCheckDirective","line":17,"character":50},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":14,"character":1},"arguments":[{"selector":"[hciHasRoleUnlessNull]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":22,"character":20},{"__symbolic":"reference","module":"@angular/core","name":"TemplateRef","line":23,"character":18,"arguments":[{"__symbolic":"reference","name":"Object"}]},{"__symbolic":"reference","module":"../user.service","name":"UserService","line":24,"character":13}]}],"hciHasRoleUnlessNull":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":28,"character":3}}]}],"_updateView":[{"__symbolic":"method"}]}},"HciHasRoleUnlessNullContext":{"__symbolic":"class"}}}]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TemplateRef, ViewContainerRef } from "@angular/core";
|
|
2
|
+
import { UserService } from "../user.service";
|
|
3
|
+
/**
|
|
4
|
+
* A structural directive for adding and removing elements of the client application based on a users <em>role</em>
|
|
5
|
+
* authorization claims.
|
|
6
|
+
*
|
|
7
|
+
* This directive requires the {@link UserService} as a provider.
|
|
8
|
+
*
|
|
9
|
+
* @since 1.0.0
|
|
10
|
+
*/
|
|
11
|
+
export declare class RoleCheckDirective {
|
|
12
|
+
protected _viewContainer: ViewContainerRef;
|
|
13
|
+
protected _templateRef: TemplateRef<Object>;
|
|
14
|
+
protected _usrSvc: UserService;
|
|
15
|
+
protected _lastCheck: boolean;
|
|
16
|
+
constructor(_viewContainer: ViewContainerRef, _templateRef: TemplateRef<Object>, _usrSvc: UserService);
|
|
17
|
+
/**
|
|
18
|
+
* Calculates the availability of a decorated element based on the authenticated users available roles.
|
|
19
|
+
*
|
|
20
|
+
* @param roleName for the role required to make the decorated element available
|
|
21
|
+
*/
|
|
22
|
+
hciHasRole: string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
/*
|
|
11
|
+
* Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
|
|
12
|
+
*/
|
|
13
|
+
import { Directive, Input, TemplateRef, ViewContainerRef, isDevMode } from "@angular/core";
|
|
14
|
+
import { UserService } from "../user.service";
|
|
15
|
+
/**
|
|
16
|
+
* A structural directive for adding and removing elements of the client application based on a users <em>role</em>
|
|
17
|
+
* authorization claims.
|
|
18
|
+
*
|
|
19
|
+
* This directive requires the {@link UserService} as a provider.
|
|
20
|
+
*
|
|
21
|
+
* @since 1.0.0
|
|
22
|
+
*/
|
|
23
|
+
let RoleCheckDirective = class RoleCheckDirective {
|
|
24
|
+
constructor(_viewContainer, _templateRef, _usrSvc) {
|
|
25
|
+
this._viewContainer = _viewContainer;
|
|
26
|
+
this._templateRef = _templateRef;
|
|
27
|
+
this._usrSvc = _usrSvc;
|
|
28
|
+
this._lastCheck = null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Calculates the availability of a decorated element based on the authenticated users available roles.
|
|
32
|
+
*
|
|
33
|
+
* @param roleName for the role required to make the decorated element available
|
|
34
|
+
*/
|
|
35
|
+
set hciHasRole(roleName) {
|
|
36
|
+
if (isDevMode() && console && console.debug) {
|
|
37
|
+
console.debug("hciHasRole");
|
|
38
|
+
}
|
|
39
|
+
this._usrSvc.getAuthenticatedUser().subscribe((authUser) => {
|
|
40
|
+
let found;
|
|
41
|
+
if (authUser && authUser.Roles) {
|
|
42
|
+
found = authUser.Roles.some((role) => {
|
|
43
|
+
return role.RoleName === roleName;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
found = false;
|
|
48
|
+
}
|
|
49
|
+
if (found && (this._lastCheck === null || !this._lastCheck)) {
|
|
50
|
+
this._viewContainer.createEmbeddedView(this._templateRef);
|
|
51
|
+
}
|
|
52
|
+
else if (!found && (this._lastCheck === null || this._lastCheck)) {
|
|
53
|
+
this._viewContainer.clear();
|
|
54
|
+
}
|
|
55
|
+
}, (error) => {
|
|
56
|
+
// TODO: BHY (08/19/16) - Determine requirements around errors and then REMOVE CONSOLE LOGGING. Display to user,
|
|
57
|
+
// log to external source, gobble?
|
|
58
|
+
// Gobble up the error.
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
__decorate([
|
|
63
|
+
Input(),
|
|
64
|
+
__metadata("design:type", String),
|
|
65
|
+
__metadata("design:paramtypes", [String])
|
|
66
|
+
], RoleCheckDirective.prototype, "hciHasRole", null);
|
|
67
|
+
RoleCheckDirective = __decorate([
|
|
68
|
+
Directive({
|
|
69
|
+
selector: "[hciHasRole]",
|
|
70
|
+
providers: [UserService]
|
|
71
|
+
}),
|
|
72
|
+
__metadata("design:paramtypes", [ViewContainerRef,
|
|
73
|
+
TemplateRef,
|
|
74
|
+
UserService])
|
|
75
|
+
], RoleCheckDirective);
|
|
76
|
+
export { RoleCheckDirective };
|
|
77
|
+
//# sourceMappingURL=role-check.directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-check.directive.js","sourceRoot":"","sources":["../../../src/authorization/role-check.directive.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;GAEG;AACH,OAAO,EAAC,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AAEzF,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAG5C;;;;;;;GAOG;AAKH,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IAG7B,YAAsB,cAAgC,EAChC,YAAiC,EACjC,OAAoB;QAFpB,mBAAc,GAAd,cAAc,CAAkB;QAChC,iBAAY,GAAZ,YAAY,CAAqB;QACjC,YAAO,GAAP,OAAO,CAAa;QAJhC,eAAU,GAAY,IAAI,CAAC;IAKrC,CAAC;IAED;;;;OAIG;IAEH,IAAI,UAAU,CAAC,QAAgB;QAC7B,IAAI,SAAS,EAAE,IAAS,OAAO,IAAS,OAAO,CAAC,KAAK,EAAE;YACrD,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;SAC7B;QAED,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC,SAAS,CAAC,CAAC,QAAoB,EAAE,EAAE;YACrE,IAAI,KAAc,CAAC;YAEnB,IAAI,QAAQ,IAAI,QAAQ,CAAC,KAAK,EAAE;gBAC9B,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;oBACnC,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC;gBACpC,CAAC,CAAC,CAAC;aACJ;iBAAM;gBACL,KAAK,GAAG,KAAK,CAAC;aACf;YAED,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,UAAU,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;gBAC3D,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;aAC3D;iBAAM,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,UAAU,KAAK,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE;gBAClE,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;aAC7B;QACH,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE;YACX,gHAAgH;YAChH,kCAAkC;YAClC,uBAAuB;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA3BC;IADC,KAAK,EAAE;;;oDA2BP;AAxCU,kBAAkB;IAJ9B,SAAS,CAAC;QACT,QAAQ,EAAE,cAAc;QACxB,SAAS,EAAE,CAAC,WAAW,CAAC;KACzB,CAAC;qCAIsC,gBAAgB;QAClB,WAAW;QAChB,WAAW;GAL/B,kBAAkB,CAyC9B;SAzCY,kBAAkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"RoleCheckDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":16,"character":1},"arguments":[{"selector":"[hciHasRole]","providers":[{"__symbolic":"reference","module":"../user.service","name":"UserService","line":18,"character":14}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":23,"character":40},{"__symbolic":"reference","module":"@angular/core","name":"TemplateRef","line":24,"character":38,"arguments":[{"__symbolic":"reference","name":"Object"}]},{"__symbolic":"reference","module":"../user.service","name":"UserService","line":25,"character":33}]}],"hciHasRole":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}]}}}}]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PermissionEntity } from "./permission.entity";
|
|
2
|
+
/**
|
|
3
|
+
* An immutable representation of an HCI role entity, which represents an authorization claim associated with an authenticated
|
|
4
|
+
* subject.
|
|
5
|
+
*
|
|
6
|
+
* @since 1.0.0
|
|
7
|
+
*/
|
|
8
|
+
export declare class RoleEntity {
|
|
9
|
+
private roleName;
|
|
10
|
+
private permissions?;
|
|
11
|
+
constructor(roleName: string, permissions?: PermissionEntity[]);
|
|
12
|
+
/**
|
|
13
|
+
* An accessor for the name of this role.
|
|
14
|
+
*
|
|
15
|
+
* @returns {string} the role name
|
|
16
|
+
* @constructor
|
|
17
|
+
*/
|
|
18
|
+
readonly RoleName: string;
|
|
19
|
+
/**
|
|
20
|
+
* An accessor for a collection of {@link PermissionEntity} authorization claims that define this role. Permissions
|
|
21
|
+
* provide a finer grained authorization claim description and are not required.
|
|
22
|
+
*
|
|
23
|
+
* @returns {PermissionEntity[]} a collection of permission entities
|
|
24
|
+
* @constructor
|
|
25
|
+
*/
|
|
26
|
+
readonly Permissions: PermissionEntity[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An immutable representation of an HCI role entity, which represents an authorization claim associated with an authenticated
|
|
3
|
+
* subject.
|
|
4
|
+
*
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
export class RoleEntity {
|
|
8
|
+
constructor(roleName, permissions) {
|
|
9
|
+
this.roleName = roleName;
|
|
10
|
+
this.permissions = permissions;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* An accessor for the name of this role.
|
|
14
|
+
*
|
|
15
|
+
* @returns {string} the role name
|
|
16
|
+
* @constructor
|
|
17
|
+
*/
|
|
18
|
+
get RoleName() {
|
|
19
|
+
return this.roleName;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* An accessor for a collection of {@link PermissionEntity} authorization claims that define this role. Permissions
|
|
23
|
+
* provide a finer grained authorization claim description and are not required.
|
|
24
|
+
*
|
|
25
|
+
* @returns {PermissionEntity[]} a collection of permission entities
|
|
26
|
+
* @constructor
|
|
27
|
+
*/
|
|
28
|
+
get Permissions() {
|
|
29
|
+
return this.permissions;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=role.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role.entity.js","sourceRoot":"","sources":["../../../src/authorization/role.entity.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IACrB,YAAoB,QAAgB,EAAU,WAAgC;QAA1D,aAAQ,GAAR,QAAQ,CAAQ;QAAU,gBAAW,GAAX,WAAW,CAAqB;IAAG,CAAC;IAElF;;;;;OAKG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"RoleEntity":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"./permission.entity","name":"PermissionEntity","line":12,"character":62}]}]}]}}}}]
|
|
@@ -0,0 +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
|
+
readonly Id: string;
|
|
22
|
+
/**
|
|
23
|
+
* An accessor for the users application identifier/username.
|
|
24
|
+
*
|
|
25
|
+
* @returns {string} the application id/username
|
|
26
|
+
* @constructor
|
|
27
|
+
*/
|
|
28
|
+
readonly 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
|
+
readonly Roles: RoleEntity[];
|
|
36
|
+
/**
|
|
37
|
+
* An accessor for the users firstname.
|
|
38
|
+
*
|
|
39
|
+
* @return {string} the firstname
|
|
40
|
+
* @constructor
|
|
41
|
+
*/
|
|
42
|
+
readonly Firstname: string;
|
|
43
|
+
/**
|
|
44
|
+
* A accessor for the users lastname.
|
|
45
|
+
*
|
|
46
|
+
* @return {string} the lastname
|
|
47
|
+
* @constructor
|
|
48
|
+
*/
|
|
49
|
+
readonly 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
|
+
readonly Href: string;
|
|
57
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An immutable representation of an HCI user entity.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
export class UserEntity {
|
|
7
|
+
constructor(id, username, roles, firstname, lastname, href) {
|
|
8
|
+
this.id = id;
|
|
9
|
+
this.username = username;
|
|
10
|
+
this.roles = roles;
|
|
11
|
+
this.firstname = firstname;
|
|
12
|
+
this.lastname = lastname;
|
|
13
|
+
this.href = href;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* An accessor for the users system id.
|
|
17
|
+
*
|
|
18
|
+
* @returns {string} the system id
|
|
19
|
+
* @constructor
|
|
20
|
+
*/
|
|
21
|
+
get Id() {
|
|
22
|
+
return this.id;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* An accessor for the users application identifier/username.
|
|
26
|
+
*
|
|
27
|
+
* @returns {string} the application id/username
|
|
28
|
+
* @constructor
|
|
29
|
+
*/
|
|
30
|
+
get Username() {
|
|
31
|
+
return this.username;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* An accessor for the users assigned role authorization claims.
|
|
35
|
+
*
|
|
36
|
+
* @returns {@code RoleEntity[]} the role authorization claims
|
|
37
|
+
* @constructor
|
|
38
|
+
*/
|
|
39
|
+
get Roles() {
|
|
40
|
+
return this.roles;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* An accessor for the users firstname.
|
|
44
|
+
*
|
|
45
|
+
* @return {string} the firstname
|
|
46
|
+
* @constructor
|
|
47
|
+
*/
|
|
48
|
+
get Firstname() {
|
|
49
|
+
return this.firstname;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A accessor for the users lastname.
|
|
53
|
+
*
|
|
54
|
+
* @return {string} the lastname
|
|
55
|
+
* @constructor
|
|
56
|
+
*/
|
|
57
|
+
get Lastname() {
|
|
58
|
+
return this.lastname;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A access for the users fully qualified href location on the system.
|
|
62
|
+
*
|
|
63
|
+
* @return {string} the href location
|
|
64
|
+
* @constructor
|
|
65
|
+
*/
|
|
66
|
+
get Href() {
|
|
67
|
+
return this.href;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=user.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../src/user.entity.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,OAAO,UAAU;IACrB,YAAoB,EAAU,EACV,QAAgB,EAChB,KAAoB,EACpB,SAAkB,EAClB,QAAiB,EACjB,IAAa;QALb,OAAE,GAAF,EAAE,CAAQ;QACV,aAAQ,GAAR,QAAQ,CAAQ;QAChB,UAAK,GAAL,KAAK,CAAe;QACpB,cAAS,GAAT,SAAS,CAAS;QAClB,aAAQ,GAAR,QAAQ,CAAS;QACjB,SAAI,GAAJ,IAAI,CAAS;IACjC,CAAC;IAED;;;;;OAKG;IACH,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CAEF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"UserEntity":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"./authorization/role.entity","name":"RoleEntity","line":13,"character":30}]},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"}]}]}}}}]
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var UserModule_1;
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
|
|
10
|
+
*/
|
|
11
|
+
import { NgModule } from "@angular/core";
|
|
12
|
+
import { CommonModule } from "@angular/common";
|
|
13
|
+
import { ReactiveFormsModule, FormsModule } from "@angular/forms";
|
|
14
|
+
import { UserService } from "./user.service";
|
|
15
|
+
import { RoleCheckDirective } from "./authorization/role-check.directive";
|
|
16
|
+
import { RoleCheckUnlessNullDirective } from "./authorization/role-check-unless-null.directive";
|
|
17
|
+
/**
|
|
18
|
+
* A feature module for user related services, directives, pipes, etc...
|
|
19
|
+
*
|
|
20
|
+
* @since 1.0.0
|
|
21
|
+
*/
|
|
22
|
+
let UserModule = UserModule_1 = class UserModule {
|
|
23
|
+
static forRoot() {
|
|
24
|
+
return {
|
|
25
|
+
providers: [
|
|
26
|
+
UserService
|
|
27
|
+
],
|
|
28
|
+
ngModule: UserModule_1
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
UserModule = UserModule_1 = __decorate([
|
|
33
|
+
NgModule({
|
|
34
|
+
imports: [
|
|
35
|
+
CommonModule,
|
|
36
|
+
ReactiveFormsModule,
|
|
37
|
+
FormsModule
|
|
38
|
+
],
|
|
39
|
+
declarations: [
|
|
40
|
+
RoleCheckDirective,
|
|
41
|
+
RoleCheckUnlessNullDirective
|
|
42
|
+
],
|
|
43
|
+
exports: [
|
|
44
|
+
RoleCheckDirective,
|
|
45
|
+
RoleCheckUnlessNullDirective
|
|
46
|
+
]
|
|
47
|
+
})
|
|
48
|
+
], UserModule);
|
|
49
|
+
export { UserModule };
|
|
50
|
+
//# sourceMappingURL=user.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.module.js","sourceRoot":"","sources":["../../src/user.module.ts"],"names":[],"mappings":";;;;;;;AAAA;;GAEG;AACH,OAAO,EAAsB,QAAQ,EAAC,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,mBAAmB,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAC,4BAA4B,EAAC,MAAM,kDAAkD,CAAC;AAE9F;;;;GAIG;AAgBH,IAAa,UAAU,kBAAvB,MAAa,UAAU;IACrB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,SAAS,EAAE;gBACT,WAAW;aACZ;YACD,QAAQ,EAAE,YAAU;SACrB,CAAC;IACJ,CAAC;CACF,CAAA;AATY,UAAU;IAftB,QAAQ,CAAC;QACR,OAAO,EAAE;YACP,YAAY;YACZ,mBAAmB;YACnB,WAAW;SACZ;QACD,YAAY,EAAE;YACZ,kBAAkB;YAClB,4BAA4B;SAC7B;QACD,OAAO,EAAE;YACP,kBAAkB;YAClB,4BAA4B;SAC7B;KACF,CAAC;GACW,UAAU,CAStB;SATY,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"UserModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":16,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":18,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":19,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":20,"character":4}],"declarations":[{"__symbolic":"reference","module":"./authorization/role-check.directive","name":"RoleCheckDirective","line":23,"character":4},{"__symbolic":"reference","module":"./authorization/role-check-unless-null.directive","name":"RoleCheckUnlessNullDirective","line":24,"character":4}],"exports":[{"__symbolic":"reference","module":"./authorization/role-check.directive","name":"RoleCheckDirective","line":27,"character":4},{"__symbolic":"reference","module":"./authorization/role-check-unless-null.directive","name":"RoleCheckUnlessNullDirective","line":28,"character":4}]}]}],"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"providers":[{"__symbolic":"reference","module":"./user.service","name":"UserService","line":35,"character":8}],"ngModule":{"__symbolic":"reference","name":"UserModule"}}}}}}}]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview This file was generated by the Angular template compiler. Do not edit.
|
|
3
|
+
*
|
|
4
|
+
* @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes}
|
|
5
|
+
* tslint:disable
|
|
6
|
+
*/
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
import * as i1 from "./user.module";
|
|
9
|
+
import * as i2 from "@angular/common";
|
|
10
|
+
import * as i3 from "@angular/forms";
|
|
11
|
+
var UserModuleNgFactory = i0.ɵcmf(i1.UserModule, [], function (_l) { return i0.ɵmod([i0.ɵmpd(512, i0.ComponentFactoryResolver, i0.ɵCodegenComponentFactoryResolver, [[8, []], [3, i0.ComponentFactoryResolver], i0.NgModuleRef]), i0.ɵmpd(4608, i2.NgLocalization, i2.NgLocaleLocalization, [i0.LOCALE_ID, [2, i2.ɵangular_packages_common_common_a]]), i0.ɵmpd(4608, i3.FormBuilder, i3.FormBuilder, []), i0.ɵmpd(4608, i3.ɵangular_packages_forms_forms_o, i3.ɵangular_packages_forms_forms_o, []), i0.ɵmpd(1073742336, i2.CommonModule, i2.CommonModule, []), i0.ɵmpd(1073742336, i3.ɵangular_packages_forms_forms_d, i3.ɵangular_packages_forms_forms_d, []), i0.ɵmpd(1073742336, i3.ReactiveFormsModule, i3.ReactiveFormsModule, []), i0.ɵmpd(1073742336, i3.FormsModule, i3.FormsModule, []), i0.ɵmpd(1073742336, i1.UserModule, i1.UserModule, [])]); });
|
|
12
|
+
export { UserModuleNgFactory as UserModuleNgFactory };
|
|
13
|
+
//# sourceMappingURL=user.module.ngfactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.module.ngfactory.js","sourceRoot":"","sources":["../../src/user.module.ngfactory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
export declare let AUTHENTICATED_USER_ENDPOINT: InjectionToken<string>;
|
|
6
|
+
/**
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
*/
|
|
9
|
+
export declare class UserService {
|
|
10
|
+
private _http;
|
|
11
|
+
private _authenticationUserEndpoint;
|
|
12
|
+
/**
|
|
13
|
+
* The generic error message used when a server error is thrown without a status.
|
|
14
|
+
*
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
static GENERIC_ERR_MSG: string;
|
|
18
|
+
private _authenticatedUser;
|
|
19
|
+
constructor(_http: HttpClient, _authenticationUserEndpoint: string);
|
|
20
|
+
/**
|
|
21
|
+
* An accessor for an {@code Observable<UserEntity>} reflecting the currently authenticated user. If no subject is
|
|
22
|
+
* available, the appropriate response status should be returned from the server to indicate that condition
|
|
23
|
+
* (i.e. 404 - Not Found).
|
|
24
|
+
*
|
|
25
|
+
* @returns {Observable<UserEntity>} the currently authenticated user representation
|
|
26
|
+
*/
|
|
27
|
+
getAuthenticatedUser(): Observable<UserEntity>;
|
|
28
|
+
private handleError;
|
|
29
|
+
/**
|
|
30
|
+
* TODO: Add in a deserializer into the entity.
|
|
31
|
+
*
|
|
32
|
+
* @param userJson
|
|
33
|
+
* @returns {UserEntity}
|
|
34
|
+
*/
|
|
35
|
+
private buildUserEntity;
|
|
36
|
+
getPermissions(governorClass: string, governorId: number, governedClass: string): Observable<any>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
var UserService_1;
|
|
14
|
+
/*
|
|
15
|
+
* Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
|
|
16
|
+
*/
|
|
17
|
+
import { Injectable, InjectionToken, Inject, isDevMode } from "@angular/core";
|
|
18
|
+
import { HttpClient, HttpHeaders } from "@angular/common/http";
|
|
19
|
+
import { Observable, of } from "rxjs";
|
|
20
|
+
import { catchError, map } from "rxjs/operators";
|
|
21
|
+
import { UserEntity } from "./user.entity";
|
|
22
|
+
import { RoleEntity } from "./authorization/role.entity";
|
|
23
|
+
import { PermissionEntity } from "./authorization/permission.entity";
|
|
24
|
+
export let AUTHENTICATED_USER_ENDPOINT = new InjectionToken("authenticated_user_url");
|
|
25
|
+
/**
|
|
26
|
+
* @since 1.0.0
|
|
27
|
+
*/
|
|
28
|
+
let UserService = UserService_1 = class UserService {
|
|
29
|
+
constructor(_http, _authenticationUserEndpoint) {
|
|
30
|
+
this._http = _http;
|
|
31
|
+
this._authenticationUserEndpoint = _authenticationUserEndpoint;
|
|
32
|
+
this._authenticatedUser = null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* An accessor for an {@code Observable<UserEntity>} reflecting the currently authenticated user. If no subject is
|
|
36
|
+
* available, the appropriate response status should be returned from the server to indicate that condition
|
|
37
|
+
* (i.e. 404 - Not Found).
|
|
38
|
+
*
|
|
39
|
+
* @returns {Observable<UserEntity>} the currently authenticated user representation
|
|
40
|
+
*/
|
|
41
|
+
getAuthenticatedUser() {
|
|
42
|
+
if (isDevMode() && console && console.debug) {
|
|
43
|
+
console.debug("getAuthenticatedUser");
|
|
44
|
+
}
|
|
45
|
+
if (!this._authenticatedUser) {
|
|
46
|
+
if (isDevMode() && console && console.debug) {
|
|
47
|
+
console.debug("_authenticationUserEndpoint: " + this._authenticationUserEndpoint);
|
|
48
|
+
}
|
|
49
|
+
return this._http.get(this._authenticationUserEndpoint, { observe: "response" }).pipe(map((resp) => {
|
|
50
|
+
if (resp.status === 200) {
|
|
51
|
+
this._authenticatedUser = this.buildUserEntity(resp.body);
|
|
52
|
+
return this._authenticatedUser;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
throw new Error("Get authenticated user failed. " + resp.status + ": " + resp.statusText);
|
|
56
|
+
}
|
|
57
|
+
}), catchError(this.handleError));
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return of(this._authenticatedUser);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
handleError(error) {
|
|
64
|
+
let errMsg = (error.message) ? error.message : UserService_1.GENERIC_ERR_MSG;
|
|
65
|
+
return Observable.throw(errMsg);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* TODO: Add in a deserializer into the entity.
|
|
69
|
+
*
|
|
70
|
+
* @param userJson
|
|
71
|
+
* @returns {UserEntity}
|
|
72
|
+
*/
|
|
73
|
+
buildUserEntity(userJson) {
|
|
74
|
+
let roles = [];
|
|
75
|
+
if (userJson.roles) {
|
|
76
|
+
userJson.roles.map((role) => {
|
|
77
|
+
let permissions;
|
|
78
|
+
if (role.permissions) {
|
|
79
|
+
/* TODO: JEH (10/27/16) - Revisit when we determine how permission are communicated to the client, if necessary */
|
|
80
|
+
permissions = role.permissions.map((permission) => {
|
|
81
|
+
return new PermissionEntity(permission.domain, permission.actions, permission.instances);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
roles.push(new RoleEntity(role.roleName, permissions));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return new UserEntity(userJson.idUser, userJson.username, roles, userJson.firstname, userJson.lastname, userJson.href);
|
|
88
|
+
}
|
|
89
|
+
getPermissions(governorClass, governorId, governedClass) {
|
|
90
|
+
let headers = new HttpHeaders()
|
|
91
|
+
.set("SecurityGovernorClass", governorClass).set("SecurityGovernorId", String(governorId));
|
|
92
|
+
return this._http.get("/core/api/user/permissions/" + governedClass, { headers: headers });
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* The generic error message used when a server error is thrown without a status.
|
|
97
|
+
*
|
|
98
|
+
* @type {string}
|
|
99
|
+
*/
|
|
100
|
+
UserService.GENERIC_ERR_MSG = "Server error";
|
|
101
|
+
UserService = UserService_1 = __decorate([
|
|
102
|
+
Injectable(),
|
|
103
|
+
__param(1, Inject(AUTHENTICATED_USER_ENDPOINT)),
|
|
104
|
+
__metadata("design:paramtypes", [HttpClient, String])
|
|
105
|
+
], UserService);
|
|
106
|
+
export { UserService };
|
|
107
|
+
//# sourceMappingURL=user.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../src/user.service.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"AUTHENTICATED_USER_ENDPOINT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":13,"character":45},"arguments":["authenticated_user_url"]},"UserService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":18,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":29,"character":42},"arguments":[{"__symbolic":"reference","name":"AUTHENTICATED_USER_ENDPOINT"}]}]],"parameters":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":29,"character":29},{"__symbolic":"reference","name":"string"}]}],"getAuthenticatedUser":[{"__symbolic":"method"}],"handleError":[{"__symbolic":"method"}],"buildUserEntity":[{"__symbolic":"method"}],"getPermissions":[{"__symbolic":"method"}]},"statics":{"GENERIC_ERR_MSG":"Server error"}}}}]
|