@huntsman-cancer-institute/user 12.3.0 → 15.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.
Files changed (42) hide show
  1. package/authorization/role-check-unless-null.directive.d.ts +1 -1
  2. package/authorization/role-check.directive.d.ts +1 -1
  3. package/esm2020/authorization/permission.entity.mjs +45 -0
  4. package/esm2020/authorization/role-check-unless-null.directive.mjs +62 -0
  5. package/esm2020/authorization/role-check.directive.mjs +66 -0
  6. package/{esm5/authorization/role.entity.js → esm2020/authorization/role.entity.mjs} +23 -33
  7. package/esm2020/huntsman-cancer-institute-user.mjs +5 -0
  8. package/esm2020/index.mjs +20 -0
  9. package/esm2020/user.entity.mjs +70 -0
  10. package/esm2020/user.module.mjs +53 -0
  11. package/esm2020/user.service.mjs +98 -0
  12. package/fesm2015/huntsman-cancer-institute-user.mjs +427 -0
  13. package/fesm2015/huntsman-cancer-institute-user.mjs.map +1 -0
  14. package/{fesm2015/huntsman-cancer-institute-user.js → fesm2020/huntsman-cancer-institute-user.mjs} +27 -23
  15. package/fesm2020/huntsman-cancer-institute-user.mjs.map +1 -0
  16. package/package.json +24 -16
  17. package/CHANGELOG.md +0 -4
  18. package/bundles/huntsman-cancer-institute-user.umd.js +0 -500
  19. package/bundles/huntsman-cancer-institute-user.umd.js.map +0 -1
  20. package/bundles/huntsman-cancer-institute-user.umd.min.js +0 -2
  21. package/bundles/huntsman-cancer-institute-user.umd.min.js.map +0 -1
  22. package/esm2015/authorization/permission.entity.js +0 -45
  23. package/esm2015/authorization/role-check-unless-null.directive.js +0 -62
  24. package/esm2015/authorization/role-check.directive.js +0 -66
  25. package/esm2015/authorization/role.entity.js +0 -32
  26. package/esm2015/huntsman-cancer-institute-user.js +0 -5
  27. package/esm2015/index.js +0 -20
  28. package/esm2015/user.entity.js +0 -70
  29. package/esm2015/user.module.js +0 -55
  30. package/esm2015/user.service.js +0 -98
  31. package/esm5/authorization/permission.entity.js +0 -59
  32. package/esm5/authorization/role-check-unless-null.directive.js +0 -87
  33. package/esm5/authorization/role-check.directive.js +0 -73
  34. package/esm5/huntsman-cancer-institute-user.js +0 -5
  35. package/esm5/index.js +0 -20
  36. package/esm5/user.entity.js +0 -96
  37. package/esm5/user.module.js +0 -59
  38. package/esm5/user.service.js +0 -101
  39. package/fesm2015/huntsman-cancer-institute-user.js.map +0 -1
  40. package/fesm5/huntsman-cancer-institute-user.js +0 -499
  41. package/fesm5/huntsman-cancer-institute-user.js.map +0 -1
  42. package/huntsman-cancer-institute-user.d.ts +0 -5
@@ -0,0 +1,427 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, isDevMode, Injectable, Inject, Directive, Input, NgModule } from '@angular/core';
3
+ import { CommonModule } from '@angular/common';
4
+ import { ReactiveFormsModule, FormsModule } from '@angular/forms';
5
+ import * as i1 from '@angular/common/http';
6
+ import { HttpHeaders } from '@angular/common/http';
7
+ import { of, Observable } from 'rxjs';
8
+ import { map, catchError } from 'rxjs/operators';
9
+
10
+ /**
11
+ * An immutable representation of an HCI user entity.
12
+ *
13
+ * @since 1.0.0
14
+ */
15
+ class UserEntity {
16
+ constructor(id, username, roles, firstname, lastname, href) {
17
+ this.id = id;
18
+ this.username = username;
19
+ this.roles = roles;
20
+ this.firstname = firstname;
21
+ this.lastname = lastname;
22
+ this.href = href;
23
+ }
24
+ /**
25
+ * An accessor for the users system id.
26
+ *
27
+ * @returns {string} the system id
28
+ * @constructor
29
+ */
30
+ get Id() {
31
+ return this.id;
32
+ }
33
+ /**
34
+ * An accessor for the users application identifier/username.
35
+ *
36
+ * @returns {string} the application id/username
37
+ * @constructor
38
+ */
39
+ get Username() {
40
+ return this.username;
41
+ }
42
+ /**
43
+ * An accessor for the users assigned role authorization claims.
44
+ *
45
+ * @returns {@code RoleEntity[]} the role authorization claims
46
+ * @constructor
47
+ */
48
+ get Roles() {
49
+ return this.roles;
50
+ }
51
+ /**
52
+ * An accessor for the users firstname.
53
+ *
54
+ * @return {string} the firstname
55
+ * @constructor
56
+ */
57
+ get Firstname() {
58
+ return this.firstname;
59
+ }
60
+ /**
61
+ * A accessor for the users lastname.
62
+ *
63
+ * @return {string} the lastname
64
+ * @constructor
65
+ */
66
+ get Lastname() {
67
+ return this.lastname;
68
+ }
69
+ /**
70
+ * A access for the users fully qualified href location on the system.
71
+ *
72
+ * @return {string} the href location
73
+ * @constructor
74
+ */
75
+ get Href() {
76
+ return this.href;
77
+ }
78
+ }
79
+
80
+ /**
81
+ * An immutable representation of an HCI role entity, which represents an authorization claim associated with an authenticated
82
+ * subject.
83
+ *
84
+ * @since 1.0.0
85
+ */
86
+ class RoleEntity {
87
+ constructor(roleName, permissions) {
88
+ this.roleName = roleName;
89
+ this.permissions = permissions;
90
+ }
91
+ /**
92
+ * An accessor for the name of this role.
93
+ *
94
+ * @returns {string} the role name
95
+ * @constructor
96
+ */
97
+ get RoleName() {
98
+ return this.roleName;
99
+ }
100
+ /**
101
+ * An accessor for a collection of {@link PermissionEntity} authorization claims that define this role. Permissions
102
+ * provide a finer grained authorization claim description and are not required.
103
+ *
104
+ * @returns {PermissionEntity[]} a collection of permission entities
105
+ * @constructor
106
+ */
107
+ get Permissions() {
108
+ return this.permissions;
109
+ }
110
+ }
111
+
112
+ /*
113
+ * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
114
+ */
115
+ /**
116
+ * An immutable representation of an HCI permission entity, which represents a fine grained authorization claim that can
117
+ * define a {@link RoleEntity}.
118
+ *
119
+ * @since 1.0.0
120
+ */
121
+ class PermissionEntity {
122
+ constructor(domain, actions, instances) {
123
+ this.domain = domain;
124
+ this.actions = actions;
125
+ this.instances = instances;
126
+ }
127
+ /**
128
+ * An accessor for the domain this permission is defined for (i.e. user, study, specimen, etc...).
129
+ *
130
+ * @returns {string} the domain of this permission
131
+ * @constructor
132
+ */
133
+ get Domain() {
134
+ return this.domain;
135
+ }
136
+ /**
137
+ * An accessor for the actions that this permission allows in the specified domain (i.e. create, read, activate, manage
138
+ * etc...). If no actions are defined, this permission claims access to all actions of the specified domain.
139
+ *
140
+ * @returns {string[]} an array of actions for the specified domain
141
+ * @constructor
142
+ */
143
+ get Actions() {
144
+ return this.actions;
145
+ }
146
+ /**
147
+ * An accessor for the instances that this permission is applicable to in the specified domain (i.e. joe, 1234, study-foo,
148
+ * etc...). If no instances are defined, this permission claims applicability to all instances of the specified domain.
149
+ * @returns {string[]}
150
+ * @constructor
151
+ */
152
+ get Instances() {
153
+ return this.instances;
154
+ }
155
+ }
156
+
157
+ /*
158
+ * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
159
+ */
160
+ let AUTHENTICATED_USER_ENDPOINT = new InjectionToken("authenticated_user_url");
161
+ /**
162
+ * @since 1.0.0
163
+ */
164
+ class UserService {
165
+ constructor(_http, _authenticationUserEndpoint) {
166
+ this._http = _http;
167
+ this._authenticationUserEndpoint = _authenticationUserEndpoint;
168
+ this._authenticatedUser = null;
169
+ }
170
+ /**
171
+ * An accessor for an {@code Observable<UserEntity>} reflecting the currently authenticated user. If no subject is
172
+ * available, the appropriate response status should be returned from the server to indicate that condition
173
+ * (i.e. 404 - Not Found).
174
+ *
175
+ * @returns {Observable<UserEntity>} the currently authenticated user representation
176
+ */
177
+ getAuthenticatedUser() {
178
+ if (isDevMode() && console && console.debug) {
179
+ console.debug("getAuthenticatedUser");
180
+ }
181
+ if (!this._authenticatedUser) {
182
+ if (isDevMode() && console && console.debug) {
183
+ console.debug("_authenticationUserEndpoint: " + this._authenticationUserEndpoint);
184
+ }
185
+ return this._http.get(this._authenticationUserEndpoint, { observe: "response" }).pipe(map((resp) => {
186
+ if (resp.status === 200) {
187
+ this._authenticatedUser = this.buildUserEntity(resp.body);
188
+ return this._authenticatedUser;
189
+ }
190
+ else {
191
+ throw new Error("Get authenticated user failed. " + resp.status + ": " + resp.statusText);
192
+ }
193
+ }), catchError(this.handleError));
194
+ }
195
+ else {
196
+ return of(this._authenticatedUser);
197
+ }
198
+ }
199
+ handleError(error) {
200
+ let errMsg = (error.message) ? error.message : UserService.GENERIC_ERR_MSG;
201
+ return Observable.throw(errMsg);
202
+ }
203
+ /**
204
+ * TODO: Add in a deserializer into the entity.
205
+ *
206
+ * @param userJson
207
+ * @returns {UserEntity}
208
+ */
209
+ buildUserEntity(userJson) {
210
+ let roles = [];
211
+ if (userJson.roles) {
212
+ userJson.roles.map((role) => {
213
+ let permissions;
214
+ if (role.permissions) {
215
+ /* TODO: JEH (10/27/16) - Revisit when we determine how permission are communicated to the client, if necessary */
216
+ permissions = role.permissions.map((permission) => {
217
+ return new PermissionEntity(permission.domain, permission.actions, permission.instances);
218
+ });
219
+ }
220
+ roles.push(new RoleEntity(role.roleName, permissions));
221
+ });
222
+ }
223
+ return new UserEntity(userJson.idUser, userJson.username, roles, userJson.firstname, userJson.lastname, userJson.href);
224
+ }
225
+ getPermissions(governorClass, governorId, governedClass) {
226
+ let headers = new HttpHeaders()
227
+ .set("SecurityGovernorClass", governorClass).set("SecurityGovernorId", String(governorId));
228
+ return this._http.get("/core/api/user/permissions/" + governedClass, { headers: headers });
229
+ }
230
+ }
231
+ /**
232
+ * The generic error message used when a server error is thrown without a status.
233
+ *
234
+ * @type {string}
235
+ */
236
+ UserService.GENERIC_ERR_MSG = "Server error";
237
+ UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UserService, deps: [{ token: i1.HttpClient }, { token: AUTHENTICATED_USER_ENDPOINT }], target: i0.ɵɵFactoryTarget.Injectable });
238
+ UserService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UserService });
239
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UserService, decorators: [{
240
+ type: Injectable
241
+ }], ctorParameters: function () {
242
+ return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
243
+ type: Inject,
244
+ args: [AUTHENTICATED_USER_ENDPOINT]
245
+ }] }];
246
+ } });
247
+
248
+ /*
249
+ * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
250
+ */
251
+ /**
252
+ * A structural directive for adding and removing elements of the client application based on a users <em>role</em>
253
+ * authorization claims.
254
+ *
255
+ * This directive requires the {@link UserService} as a provider.
256
+ *
257
+ * @since 1.0.0
258
+ */
259
+ class RoleCheckDirective {
260
+ constructor(_viewContainer, _templateRef, _usrSvc) {
261
+ this._viewContainer = _viewContainer;
262
+ this._templateRef = _templateRef;
263
+ this._usrSvc = _usrSvc;
264
+ this._lastCheck = null;
265
+ }
266
+ /**
267
+ * Calculates the availability of a decorated element based on the authenticated users available roles.
268
+ *
269
+ * @param roleName for the role required to make the decorated element available
270
+ */
271
+ set hciHasRole(roleName) {
272
+ if (isDevMode() && console && console.debug) {
273
+ console.debug("hciHasRole");
274
+ }
275
+ this._usrSvc.getAuthenticatedUser().subscribe((authUser) => {
276
+ let found;
277
+ if (authUser && authUser.Roles) {
278
+ found = authUser.Roles.some((role) => {
279
+ return role.RoleName === roleName;
280
+ });
281
+ }
282
+ else {
283
+ found = false;
284
+ }
285
+ if (found && (this._lastCheck === null || !this._lastCheck)) {
286
+ this._viewContainer.createEmbeddedView(this._templateRef);
287
+ }
288
+ else if (!found && (this._lastCheck === null || this._lastCheck)) {
289
+ this._viewContainer.clear();
290
+ }
291
+ }, (error) => {
292
+ // TODO: BHY (08/19/16) - Determine requirements around errors and then REMOVE CONSOLE LOGGING. Display to user,
293
+ // log to external source, gobble?
294
+ // Gobble up the error.
295
+ });
296
+ }
297
+ }
298
+ RoleCheckDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RoleCheckDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: UserService }], target: i0.ɵɵFactoryTarget.Directive });
299
+ RoleCheckDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: RoleCheckDirective, selector: "[hciHasRole]", inputs: { hciHasRole: "hciHasRole" }, providers: [UserService], ngImport: i0 });
300
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RoleCheckDirective, decorators: [{
301
+ type: Directive,
302
+ args: [{
303
+ selector: "[hciHasRole]",
304
+ providers: [UserService]
305
+ }]
306
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: UserService }]; }, propDecorators: { hciHasRole: [{
307
+ type: Input
308
+ }] } });
309
+
310
+ /*
311
+ * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
312
+ */
313
+ /**
314
+ * An extension of the {@link RoleCheckDirective} the only evaluates the role if is it not null or undefined.
315
+ *
316
+ * This directive requires the {@link UserService} as a provider.
317
+ *
318
+ * @since 1.0.0
319
+ */
320
+ class RoleCheckUnlessNullDirective extends RoleCheckDirective {
321
+ constructor(_viewContainer, _templateRef, _usrSvc) {
322
+ super(_viewContainer, _templateRef, _usrSvc);
323
+ this._context = new HciHasRoleUnlessNullContext();
324
+ }
325
+ set hciHasRoleUnlessNull(roleName) {
326
+ if (!roleName) {
327
+ // if the roleName is undefined or null then render
328
+ if (this._context._condition !== true) {
329
+ this._context._condition = true;
330
+ this._updateView();
331
+ }
332
+ }
333
+ else {
334
+ // otherwise delegate the check to RoleCheckDirective
335
+ this.hciHasRole = roleName;
336
+ }
337
+ }
338
+ _updateView() {
339
+ this._viewContainer.clear();
340
+ if (this._context._condition) {
341
+ this._viewContainer.createEmbeddedView(this._templateRef, this._context);
342
+ }
343
+ else {
344
+ this._viewContainer.createEmbeddedView(this._templateRef, this._context);
345
+ }
346
+ }
347
+ }
348
+ RoleCheckUnlessNullDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RoleCheckUnlessNullDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: UserService }], target: i0.ɵɵFactoryTarget.Directive });
349
+ RoleCheckUnlessNullDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: RoleCheckUnlessNullDirective, selector: "[hciHasRoleUnlessNull]", inputs: { hciHasRoleUnlessNull: "hciHasRoleUnlessNull" }, usesInheritance: true, ngImport: i0 });
350
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RoleCheckUnlessNullDirective, decorators: [{
351
+ type: Directive,
352
+ args: [{
353
+ selector: "[hciHasRoleUnlessNull]"
354
+ }]
355
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: UserService }]; }, propDecorators: { hciHasRoleUnlessNull: [{
356
+ type: Input
357
+ }] } });
358
+ /**
359
+ * I totally ripped off *ngIf source to get this to work correctly to prevent infinit loop rendering.
360
+ */
361
+ class HciHasRoleUnlessNullContext {
362
+ constructor() {
363
+ this._condition = false;
364
+ }
365
+ }
366
+
367
+ /*
368
+ * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
369
+ */
370
+ /**
371
+ * A feature module for user related services, directives, pipes, etc...
372
+ *
373
+ * @since 1.0.0
374
+ */
375
+ class UserModule {
376
+ static forRoot() {
377
+ return {
378
+ providers: [
379
+ UserService
380
+ ],
381
+ ngModule: UserModule
382
+ };
383
+ }
384
+ }
385
+ UserModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UserModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
386
+ UserModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: UserModule, declarations: [RoleCheckDirective,
387
+ RoleCheckUnlessNullDirective], imports: [CommonModule,
388
+ ReactiveFormsModule,
389
+ FormsModule], exports: [RoleCheckDirective,
390
+ RoleCheckUnlessNullDirective] });
391
+ UserModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UserModule, imports: [CommonModule,
392
+ ReactiveFormsModule,
393
+ FormsModule] });
394
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UserModule, decorators: [{
395
+ type: NgModule,
396
+ args: [{
397
+ imports: [
398
+ CommonModule,
399
+ ReactiveFormsModule,
400
+ FormsModule
401
+ ],
402
+ declarations: [
403
+ RoleCheckDirective,
404
+ RoleCheckUnlessNullDirective
405
+ ],
406
+ exports: [
407
+ RoleCheckDirective,
408
+ RoleCheckUnlessNullDirective
409
+ ]
410
+ }]
411
+ }] });
412
+
413
+ /*
414
+ * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
415
+ */
416
+ /**
417
+ * A barrel file for the HCI ng2 user package.
418
+ *
419
+ * @since 1.0.0
420
+ */
421
+
422
+ /**
423
+ * Generated bundle index. Do not edit.
424
+ */
425
+
426
+ export { AUTHENTICATED_USER_ENDPOINT, PermissionEntity, RoleCheckDirective, RoleCheckUnlessNullDirective, RoleEntity, UserEntity, UserModule, UserService };
427
+ //# sourceMappingURL=huntsman-cancer-institute-user.mjs.map
@@ -0,0 +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} 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 Observable.throw(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;AALb,QAAA,IAAE,CAAA,EAAA,GAAF,EAAE,CAAQ;AACV,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAQ;AAChB,QAAA,IAAK,CAAA,KAAA,GAAL,KAAK,CAAe;AACpB,QAAA,IAAS,CAAA,SAAA,GAAT,SAAS,CAAS;AAClB,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAS;AACjB,QAAA,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;;;;;AAKG;AACH,IAAA,IAAI,KAAK,GAAA;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;KACnB;AAED;;;;;AAKG;AACH,IAAA,IAAI,SAAS,GAAA;QACX,OAAO,IAAI,CAAC,SAAS,CAAC;KACvB;AAED;;;;;AAKG;AACH,IAAA,IAAI,QAAQ,GAAA;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;KACtB;AAED;;;;;AAKG;AACH,IAAA,IAAI,IAAI,GAAA;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;KAClB;AAEF;;AC1ED;;;;;AAKG;MACU,UAAU,CAAA;IACrB,WAAqB,CAAA,QAAgB,EAAU,WAAgC,EAAA;AAA1D,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAQ;AA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D,oBAAA,OAAO,EAAE;wBACP,kBAAkB;wBAClB,4BAA4B;AAC7B,qBAAA;iBACF,CAAA;;;AC9BD;;AAEG;AAEH;;;;AAIG;;ACRH;;AAEG;;;;"}
@@ -1,8 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, isDevMode, ɵɵngDeclareFactory, ɵɵFactoryTarget, ɵɵngDeclareInjectable, ɵɵngDeclareClassMetadata, Injectable, Inject, ViewContainerRef, TemplateRef, ɵɵngDeclareDirective, Directive, Input, ɵɵngDeclareNgModule, ɵɵngDeclareInjector, NgModule } from '@angular/core';
2
+ import { InjectionToken, isDevMode, Injectable, Inject, Directive, Input, NgModule } from '@angular/core';
3
3
  import { CommonModule } from '@angular/common';
4
4
  import { ReactiveFormsModule, FormsModule } from '@angular/forms';
5
- import { HttpHeaders, HttpClient } from '@angular/common/http';
5
+ import * as i1 from '@angular/common/http';
6
+ import { HttpHeaders } from '@angular/common/http';
6
7
  import { of, Observable } from 'rxjs';
7
8
  import { map, catchError } from 'rxjs/operators';
8
9
 
@@ -233,11 +234,11 @@ class UserService {
233
234
  * @type {string}
234
235
  */
235
236
  UserService.GENERIC_ERR_MSG = "Server error";
236
- UserService.ɵfac = ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UserService, deps: [{ token: HttpClient }, { token: AUTHENTICATED_USER_ENDPOINT }], target: ɵɵFactoryTarget.Injectable });
237
- UserService.ɵprov = ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UserService });
238
- ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UserService, decorators: [{
237
+ UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UserService, deps: [{ token: i1.HttpClient }, { token: AUTHENTICATED_USER_ENDPOINT }], target: i0.ɵɵFactoryTarget.Injectable });
238
+ UserService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UserService });
239
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UserService, decorators: [{
239
240
  type: Injectable
240
- }], ctorParameters: function () { return [{ type: HttpClient }, { type: undefined, decorators: [{
241
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
241
242
  type: Inject,
242
243
  args: [AUTHENTICATED_USER_ENDPOINT]
243
244
  }] }]; } });
@@ -292,15 +293,15 @@ class RoleCheckDirective {
292
293
  });
293
294
  }
294
295
  }
295
- RoleCheckDirective.ɵfac = ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RoleCheckDirective, deps: [{ token: ViewContainerRef }, { token: TemplateRef }, { token: UserService }], target: ɵɵFactoryTarget.Directive });
296
- RoleCheckDirective.ɵdir = ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: RoleCheckDirective, selector: "[hciHasRole]", inputs: { hciHasRole: "hciHasRole" }, providers: [UserService], ngImport: i0 });
297
- ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RoleCheckDirective, decorators: [{
296
+ RoleCheckDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RoleCheckDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: UserService }], target: i0.ɵɵFactoryTarget.Directive });
297
+ RoleCheckDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: RoleCheckDirective, selector: "[hciHasRole]", inputs: { hciHasRole: "hciHasRole" }, providers: [UserService], ngImport: i0 });
298
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RoleCheckDirective, decorators: [{
298
299
  type: Directive,
299
300
  args: [{
300
301
  selector: "[hciHasRole]",
301
302
  providers: [UserService]
302
303
  }]
303
- }], ctorParameters: function () { return [{ type: ViewContainerRef }, { type: TemplateRef }, { type: UserService }]; }, propDecorators: { hciHasRole: [{
304
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: UserService }]; }, propDecorators: { hciHasRole: [{
304
305
  type: Input
305
306
  }] } });
306
307
 
@@ -342,14 +343,14 @@ class RoleCheckUnlessNullDirective extends RoleCheckDirective {
342
343
  }
343
344
  }
344
345
  }
345
- RoleCheckUnlessNullDirective.ɵfac = ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RoleCheckUnlessNullDirective, deps: [{ token: ViewContainerRef }, { token: TemplateRef }, { token: UserService }], target: ɵɵFactoryTarget.Directive });
346
- RoleCheckUnlessNullDirective.ɵdir = ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: RoleCheckUnlessNullDirective, selector: "[hciHasRoleUnlessNull]", inputs: { hciHasRoleUnlessNull: "hciHasRoleUnlessNull" }, usesInheritance: true, ngImport: i0 });
347
- ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RoleCheckUnlessNullDirective, decorators: [{
346
+ RoleCheckUnlessNullDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RoleCheckUnlessNullDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: UserService }], target: i0.ɵɵFactoryTarget.Directive });
347
+ RoleCheckUnlessNullDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: RoleCheckUnlessNullDirective, selector: "[hciHasRoleUnlessNull]", inputs: { hciHasRoleUnlessNull: "hciHasRoleUnlessNull" }, usesInheritance: true, ngImport: i0 });
348
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RoleCheckUnlessNullDirective, decorators: [{
348
349
  type: Directive,
349
350
  args: [{
350
351
  selector: "[hciHasRoleUnlessNull]"
351
352
  }]
352
- }], ctorParameters: function () { return [{ type: ViewContainerRef }, { type: TemplateRef }, { type: UserService }]; }, propDecorators: { hciHasRoleUnlessNull: [{
353
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: UserService }]; }, propDecorators: { hciHasRoleUnlessNull: [{
353
354
  type: Input
354
355
  }] } });
355
356
  /**
@@ -379,18 +380,16 @@ class UserModule {
379
380
  };
380
381
  }
381
382
  }
382
- UserModule.ɵfac = ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UserModule, deps: [], target: ɵɵFactoryTarget.NgModule });
383
- UserModule.ɵmod = ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UserModule, declarations: [RoleCheckDirective,
383
+ UserModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UserModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
384
+ UserModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: UserModule, declarations: [RoleCheckDirective,
384
385
  RoleCheckUnlessNullDirective], imports: [CommonModule,
385
386
  ReactiveFormsModule,
386
387
  FormsModule], exports: [RoleCheckDirective,
387
388
  RoleCheckUnlessNullDirective] });
388
- UserModule.ɵinj = ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UserModule, imports: [[
389
- CommonModule,
390
- ReactiveFormsModule,
391
- FormsModule
392
- ]] });
393
- ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UserModule, decorators: [{
389
+ UserModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UserModule, imports: [CommonModule,
390
+ ReactiveFormsModule,
391
+ FormsModule] });
392
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UserModule, decorators: [{
394
393
  type: NgModule,
395
394
  args: [{
396
395
  imports: [
@@ -411,6 +410,11 @@ UserModule.ɵinj = ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
411
410
 
412
411
  /*
413
412
  * Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
413
+ */
414
+ /**
415
+ * A barrel file for the HCI ng2 user package.
416
+ *
417
+ * @since 1.0.0
414
418
  */
415
419
 
416
420
  /**
@@ -418,4 +422,4 @@ UserModule.ɵinj = ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
418
422
  */
419
423
 
420
424
  export { AUTHENTICATED_USER_ENDPOINT, PermissionEntity, RoleCheckDirective, RoleCheckUnlessNullDirective, RoleEntity, UserEntity, UserModule, UserService };
421
- //# sourceMappingURL=huntsman-cancer-institute-user.js.map
425
+ //# sourceMappingURL=huntsman-cancer-institute-user.mjs.map
@@ -0,0 +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} 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 Observable.throw(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":";;;;;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