@firestitch/app-acl 12.3.1 → 12.3.4
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/app/components/acl-entries/acl-entries.component.d.ts +2 -1
- package/app/components/acl-entry/acl-entry.component.d.ts +3 -1
- package/app/services/app-acl.service.d.ts +0 -2
- package/bundles/firestitch-app-acl.umd.js +55 -74
- package/bundles/firestitch-app-acl.umd.js.map +1 -1
- package/esm2015/app/components/acl-entries/acl-entries.component.js +42 -35
- package/esm2015/app/components/acl-entry/acl-entry.component.js +7 -7
- package/esm2015/app/components/acl-role/acl-role.component.js +4 -5
- package/esm2015/app/components/acl-roles/acl-roles.component.js +3 -3
- package/esm2015/app/services/app-acl.service.js +1 -28
- package/fesm2015/firestitch-app-acl.js +50 -69
- package/fesm2015/firestitch-app-acl.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,13 +2,8 @@ import { Injectable, Inject } from '@angular/core';
|
|
|
2
2
|
import { list } from '@firestitch/common';
|
|
3
3
|
import { map } from 'rxjs/operators';
|
|
4
4
|
import { ReplaySubject } from 'rxjs';
|
|
5
|
-
import { isArray } from 'lodash-es';
|
|
6
5
|
import { FS_APP_ACL_CONFIG } from './../injectors/app-acl-config.injector';
|
|
7
|
-
import * as _snakecaseKeys from 'snakecase-keys';
|
|
8
|
-
import * as _camelcaseKeys from 'camelcase-keys';
|
|
9
6
|
import * as i0 from "@angular/core";
|
|
10
|
-
const snakecaseKeys = _snakecaseKeys;
|
|
11
|
-
const camelcaseKeys = _camelcaseKeys;
|
|
12
7
|
export class FsAppAclService {
|
|
13
8
|
constructor(_appAclConfig) {
|
|
14
9
|
this._appAclConfig = _appAclConfig;
|
|
@@ -17,7 +12,6 @@ export class FsAppAclService {
|
|
|
17
12
|
if (!this._permissions$) {
|
|
18
13
|
this._permissions$ = new ReplaySubject();
|
|
19
14
|
this._appAclConfig.permissions
|
|
20
|
-
.pipe(map((data) => this.input(data)))
|
|
21
15
|
.subscribe((permissions) => {
|
|
22
16
|
this._permissions$.next(permissions);
|
|
23
17
|
this._permissions$.complete();
|
|
@@ -29,7 +23,6 @@ export class FsAppAclService {
|
|
|
29
23
|
if (!this._levels$) {
|
|
30
24
|
this._levels$ = new ReplaySubject();
|
|
31
25
|
this._appAclConfig.levels
|
|
32
|
-
.pipe(map((data) => this.input(data)))
|
|
33
26
|
.subscribe((levels) => {
|
|
34
27
|
this._levels$.next(levels);
|
|
35
28
|
this._levels$.complete();
|
|
@@ -43,26 +36,6 @@ export class FsAppAclService {
|
|
|
43
36
|
return list(data, 'name', 'value');
|
|
44
37
|
}));
|
|
45
38
|
}
|
|
46
|
-
input(data) {
|
|
47
|
-
if (isArray(data)) {
|
|
48
|
-
return data.map(item => {
|
|
49
|
-
return this._appAclConfig.case === 'snake' ? camelcaseKeys(item, { deep: true }) : item;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
return this._appAclConfig.case === 'snake' ? camelcaseKeys(data, { deep: true }) : data;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
output(data) {
|
|
57
|
-
if (isArray(data)) {
|
|
58
|
-
return data.map(item => {
|
|
59
|
-
return this._appAclConfig.case === 'snake' ? snakecaseKeys(item, { deep: true }) : item;
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
return this._appAclConfig.case === 'snake' ? snakecaseKeys(data, { deep: true }) : data;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
39
|
}
|
|
67
40
|
FsAppAclService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclService, deps: [{ token: FS_APP_ACL_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
68
41
|
FsAppAclService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclService, providedIn: 'root' });
|
|
@@ -75,4 +48,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
75
48
|
type: Inject,
|
|
76
49
|
args: [FS_APP_ACL_CONFIG]
|
|
77
50
|
}] }]; } });
|
|
78
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
51
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwLWFjbC5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2FwcC9zZXJ2aWNlcy9hcHAtYWNsLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFbkQsT0FBTyxFQUFFLElBQUksRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRTFDLE9BQU8sRUFBRSxHQUFHLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUNyQyxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBR3JDLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHdDQUF3QyxDQUFDOztBQVMzRSxNQUFNLE9BQU8sZUFBZTtJQUsxQixZQUNxQyxhQUEyQjtRQUEzQixrQkFBYSxHQUFiLGFBQWEsQ0FBYztJQUM1RCxDQUFDO0lBRUUsY0FBYztRQUVuQixJQUFJLENBQUMsSUFBSSxDQUFDLGFBQWEsRUFBRTtZQUN2QixJQUFJLENBQUMsYUFBYSxHQUFHLElBQUksYUFBYSxFQUFFLENBQUM7WUFFekMsSUFBSSxDQUFDLGFBQWEsQ0FBQyxXQUFXO2lCQUMzQixTQUFTLENBQUMsQ0FBQyxXQUFXLEVBQUUsRUFBRTtnQkFDekIsSUFBSSxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLEN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VN1YmplY3QoKTtcblxuICAgICAgdGhpcy5fYXBwQWNsQ29uZmlnLnBlcm1pc3Npb25zXG4gICAgICAgIC5zdWJzY3JpYmUoKHBlcm1pc3Npb25zKSA9PiB7XG4gICAgICAgICAgdGhpcy5fcGVybWlzc2lvbnMkLm5leHQocGVybWlzc2lvbnMpO1xuICAgICAgICAgIHRoaXMuX3Blcm1pc3Npb25zJC5jb21wbGV0ZSgpO1xuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICByZXR1cm4gdGhpcy5fcGVybWlzc2lvbnMkO1xuICB9XG5cbiAgcHVibGljIGdldExldmVscygpIHtcblxuICAgIGlmICghdGhpcy5fbGV2ZWxzJCkge1xuICAgICAgdGhpcy5fbGV2ZWxzJCA9IG5ldyBSZXBsYXlTdWJqZWN0KCk7XG5cbiAgICAgIHRoaXMuX2FwcEFjbENvbmZpZy5sZXZlbHNcbiAgICAgICAgLnN1YnNjcmliZSgobGV2ZWxzKSA9PiB7XG4gICAgICAgICAgdGhpcy5fbGV2ZWxzJC5uZXh0KGxldmVscyk7XG4gICAgICAgICAgdGhpcy5fbGV2ZWxzJC5jb21wbGV0ZSgpO1xuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICByZXR1cm4gdGhpcy5fbGV2ZWxzJDtcbiAgfVxuXG5cbiAgcHVibGljIGdldEluZGV4ZWRMZXZlbHMoKSB7XG4gICAgcmV0dXJuIHRoaXMuZ2V0TGV2ZWxzKClcbiAgICAgIC5waXBlKFxuICAgICAgICBtYXAoKGRhdGEpID0+IHtcbiAgICAgICAgICByZXR1cm4gbGlzdChkYXRhLCAnbmFtZScsICd2YWx1ZScpO1xuICAgICAgICB9KVxuICAgICAgKTtcbiAgfVxufVxuIl19
|
|
@@ -36,15 +36,13 @@ import { ItemType } from '@firestitch/filter';
|
|
|
36
36
|
import { list } from '@firestitch/common';
|
|
37
37
|
import { ReplaySubject, Subject, forkJoin, of, Observable } from 'rxjs';
|
|
38
38
|
import * as i3 from '@firestitch/message';
|
|
39
|
-
import { isArray, groupBy, forOwn, sortBy } from 'lodash-es';
|
|
40
|
-
import * as _snakecaseKeys from 'snakecase-keys';
|
|
41
|
-
import * as _camelcaseKeys from 'camelcase-keys';
|
|
42
39
|
import * as i5 from '@angular/material/form-field';
|
|
43
40
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
44
41
|
import * as i11 from '@angular/material/core';
|
|
45
42
|
import * as i14 from '@angular/forms';
|
|
46
43
|
import { ControlContainer, NgForm, FormsModule } from '@angular/forms';
|
|
47
44
|
import * as i17 from '@angular/flex-layout/flex';
|
|
45
|
+
import { groupBy, sortBy } from 'lodash-es';
|
|
48
46
|
import * as i3$1 from '@firestitch/prompt';
|
|
49
47
|
|
|
50
48
|
var AclRoleAccess;
|
|
@@ -64,8 +62,6 @@ const AclRoleAccesses = [
|
|
|
64
62
|
|
|
65
63
|
const FS_APP_ACL_CONFIG = new InjectionToken('fs-app-acl-config');
|
|
66
64
|
|
|
67
|
-
const snakecaseKeys = _snakecaseKeys;
|
|
68
|
-
const camelcaseKeys = _camelcaseKeys;
|
|
69
65
|
class FsAppAclService {
|
|
70
66
|
constructor(_appAclConfig) {
|
|
71
67
|
this._appAclConfig = _appAclConfig;
|
|
@@ -74,7 +70,6 @@ class FsAppAclService {
|
|
|
74
70
|
if (!this._permissions$) {
|
|
75
71
|
this._permissions$ = new ReplaySubject();
|
|
76
72
|
this._appAclConfig.permissions
|
|
77
|
-
.pipe(map((data) => this.input(data)))
|
|
78
73
|
.subscribe((permissions) => {
|
|
79
74
|
this._permissions$.next(permissions);
|
|
80
75
|
this._permissions$.complete();
|
|
@@ -86,7 +81,6 @@ class FsAppAclService {
|
|
|
86
81
|
if (!this._levels$) {
|
|
87
82
|
this._levels$ = new ReplaySubject();
|
|
88
83
|
this._appAclConfig.levels
|
|
89
|
-
.pipe(map((data) => this.input(data)))
|
|
90
84
|
.subscribe((levels) => {
|
|
91
85
|
this._levels$.next(levels);
|
|
92
86
|
this._levels$.complete();
|
|
@@ -100,26 +94,6 @@ class FsAppAclService {
|
|
|
100
94
|
return list(data, 'name', 'value');
|
|
101
95
|
}));
|
|
102
96
|
}
|
|
103
|
-
input(data) {
|
|
104
|
-
if (isArray(data)) {
|
|
105
|
-
return data.map(item => {
|
|
106
|
-
return this._appAclConfig.case === 'snake' ? camelcaseKeys(item, { deep: true }) : item;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
return this._appAclConfig.case === 'snake' ? camelcaseKeys(data, { deep: true }) : data;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
output(data) {
|
|
114
|
-
if (isArray(data)) {
|
|
115
|
-
return data.map(item => {
|
|
116
|
-
return this._appAclConfig.case === 'snake' ? snakecaseKeys(item, { deep: true }) : item;
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
return this._appAclConfig.case === 'snake' ? snakecaseKeys(data, { deep: true }) : data;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
97
|
}
|
|
124
98
|
FsAppAclService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclService, deps: [{ token: FS_APP_ACL_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
125
99
|
FsAppAclService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclService, providedIn: 'root' });
|
|
@@ -165,7 +139,7 @@ class FsAclRoleComponent {
|
|
|
165
139
|
data: item.data,
|
|
166
140
|
};
|
|
167
141
|
}) });
|
|
168
|
-
return this._data.saveAclRole(
|
|
142
|
+
return this._data.saveAclRole(aclRole)
|
|
169
143
|
.pipe(tap((response) => {
|
|
170
144
|
this._message.success('Saved Changes');
|
|
171
145
|
this.close(response);
|
|
@@ -256,8 +230,7 @@ class FsAclRoleComponent {
|
|
|
256
230
|
if (!this.environment) {
|
|
257
231
|
query.environmentId = null;
|
|
258
232
|
}
|
|
259
|
-
return this._data.loadAclRole(this._data.aclRole, query)
|
|
260
|
-
.pipe(map((data) => this._appAclService.input(data)));
|
|
233
|
+
return this._data.loadAclRole(this._data.aclRole, query);
|
|
261
234
|
}
|
|
262
235
|
close(data = null) {
|
|
263
236
|
this._dialogRef.close(data);
|
|
@@ -422,7 +395,7 @@ class FsAclRolesComponent {
|
|
|
422
395
|
rowActions: [
|
|
423
396
|
{
|
|
424
397
|
click: (data) => {
|
|
425
|
-
return this.deleteAclRole(
|
|
398
|
+
return this.deleteAclRole(data);
|
|
426
399
|
},
|
|
427
400
|
remove: {
|
|
428
401
|
title: 'Confirm',
|
|
@@ -436,7 +409,7 @@ class FsAclRolesComponent {
|
|
|
436
409
|
fetch: (query) => {
|
|
437
410
|
query.permissions = true;
|
|
438
411
|
return this.loadAclRoles(query)
|
|
439
|
-
.pipe(map((data) =>
|
|
412
|
+
.pipe(map((data) => data));
|
|
440
413
|
},
|
|
441
414
|
};
|
|
442
415
|
}
|
|
@@ -552,12 +525,14 @@ class FsAclEntryComponent {
|
|
|
552
525
|
this._message = _message;
|
|
553
526
|
this._data = _data;
|
|
554
527
|
this.aclRoles = [];
|
|
528
|
+
this.aclEntries = [];
|
|
555
529
|
this.indexedAclRoleLevels = {};
|
|
556
530
|
this.titleEdit = 'Edit Roles';
|
|
557
531
|
this.titleAdd = 'Assign Roles';
|
|
558
532
|
this.required = true;
|
|
559
533
|
this.save = () => {
|
|
560
|
-
|
|
534
|
+
const aclObjectEntry = Object.assign(Object.assign({}, this.aclObjectEntry), { aclEntries: this.aclEntries });
|
|
535
|
+
return this._data.saveAclObjectEntry(aclObjectEntry)
|
|
561
536
|
.subscribe((data) => {
|
|
562
537
|
this._message.success('Saved Changes');
|
|
563
538
|
this.close(data);
|
|
@@ -573,8 +548,7 @@ class FsAclEntryComponent {
|
|
|
573
548
|
}
|
|
574
549
|
}
|
|
575
550
|
ngOnInit() {
|
|
576
|
-
forkJoin(this._data.loadAclRoles(this.aclObjectEntry)
|
|
577
|
-
.pipe(map((data) => this._appAclService.input(data))), this._appAclService.getIndexedLevels())
|
|
551
|
+
forkJoin(this._data.loadAclRoles(this.aclObjectEntry), this._appAclService.getIndexedLevels())
|
|
578
552
|
.subscribe(([aclRoles, levels,]) => {
|
|
579
553
|
this.aclRoles = aclRoles;
|
|
580
554
|
this.indexedAclRoleLevels = levels;
|
|
@@ -583,12 +557,12 @@ class FsAclEntryComponent {
|
|
|
583
557
|
aclRoles: this.aclObjectEntry.aclEntries
|
|
584
558
|
.map((aclEntry) => {
|
|
585
559
|
return aclEntry.aclRole;
|
|
586
|
-
})
|
|
560
|
+
}),
|
|
587
561
|
};
|
|
588
562
|
});
|
|
589
563
|
}
|
|
590
564
|
aclObjectRoleChange(aclObjectRoles) {
|
|
591
|
-
this.
|
|
565
|
+
this.aclEntries = aclObjectRoles.reduce((aclEntries, aclObjectRole) => {
|
|
592
566
|
aclObjectRole.aclRoles.forEach(aclRole => {
|
|
593
567
|
aclEntries.push({
|
|
594
568
|
aclRoleId: aclRole.id,
|
|
@@ -624,6 +598,7 @@ class FsAclEntriesComponent {
|
|
|
624
598
|
this._confirm = _confirm;
|
|
625
599
|
this.environmentShow = true;
|
|
626
600
|
this.environmentLabel = 'Environment';
|
|
601
|
+
this.environmentKey = 'environment';
|
|
627
602
|
this.actions = [];
|
|
628
603
|
this.aclEntriesList = null;
|
|
629
604
|
this.aclEntriesConfig = null;
|
|
@@ -648,7 +623,7 @@ class FsAclEntriesComponent {
|
|
|
648
623
|
title: 'Remove All Roles',
|
|
649
624
|
template: 'Are you sure you would like to remove all roles?',
|
|
650
625
|
}).subscribe(() => {
|
|
651
|
-
const data =
|
|
626
|
+
const data = Object.assign(Object.assign({}, aclObjectEntry), { aclEntries: [] });
|
|
652
627
|
this.saveAclObjectEntry(data)
|
|
653
628
|
.subscribe(() => {
|
|
654
629
|
this.aclEntriesList.reload();
|
|
@@ -665,50 +640,54 @@ class FsAclEntriesComponent {
|
|
|
665
640
|
objects: true,
|
|
666
641
|
aclRoleState: 'active',
|
|
667
642
|
})
|
|
668
|
-
.pipe(map((response) => this._appAclService.input(response)))
|
|
669
643
|
.subscribe((aclEntries) => {
|
|
670
|
-
const objects = aclEntries
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
}
|
|
674
|
-
return items;
|
|
644
|
+
const objects = aclEntries
|
|
645
|
+
.filter((aclEntry) => (!!aclEntry.object))
|
|
646
|
+
.reduce((items, item) => {
|
|
647
|
+
return Object.assign(Object.assign({}, items), { [item.object.id]: item.object });
|
|
675
648
|
}, {});
|
|
676
|
-
const environments = aclEntries
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
return items;
|
|
649
|
+
const environments = aclEntries
|
|
650
|
+
.filter((aclEntry) => (!!aclEntry[this.environmentKey]))
|
|
651
|
+
.reduce((items, item) => {
|
|
652
|
+
const environment = item[this.environmentKey];
|
|
653
|
+
return Object.assign(Object.assign({}, items), { [environment.id]: environment });
|
|
681
654
|
}, {});
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
655
|
+
const groupedAclEntries = groupBy(aclEntries, (item) => {
|
|
656
|
+
var _a;
|
|
657
|
+
const environmentId = (_a = (item[this.environmentKey])) === null || _a === void 0 ? void 0 : _a.id;
|
|
658
|
+
return [item.aclRole.level, environmentId, item.objectId];
|
|
685
659
|
});
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
660
|
+
let aclObjectEntries = Object.keys(groupedAclEntries)
|
|
661
|
+
.reduce((accum, key) => {
|
|
662
|
+
const parts = key.split(',');
|
|
663
|
+
return [
|
|
664
|
+
...accum,
|
|
665
|
+
{
|
|
666
|
+
object: objects[parts[2]],
|
|
667
|
+
level: parts[0],
|
|
668
|
+
[`${this.environmentKey}Id`]: parts[1] ? parseInt(parts[1]) : null,
|
|
669
|
+
[this.environmentKey]: environments[parts[1]],
|
|
670
|
+
aclEntries: groupedAclEntries[key],
|
|
671
|
+
}
|
|
672
|
+
];
|
|
673
|
+
}, []);
|
|
674
|
+
const hasApp = aclObjectEntries.some((item) => {
|
|
697
675
|
return item.aclEntries.some((entry) => {
|
|
698
676
|
return !entry.objectId;
|
|
699
677
|
});
|
|
700
678
|
});
|
|
701
679
|
if (!hasApp) {
|
|
702
|
-
|
|
703
|
-
object: null,
|
|
680
|
+
aclObjectEntries.unshift({
|
|
681
|
+
object: null,
|
|
682
|
+
aclEntries: [],
|
|
704
683
|
level: 'app',
|
|
705
684
|
environmentId: null,
|
|
706
685
|
});
|
|
707
686
|
}
|
|
708
|
-
|
|
687
|
+
aclObjectEntries = sortBy(aclObjectEntries, (item) => {
|
|
709
688
|
return item.object ? item.level : '';
|
|
710
689
|
});
|
|
711
|
-
observer.next({ data:
|
|
690
|
+
observer.next({ data: aclObjectEntries });
|
|
712
691
|
observer.complete();
|
|
713
692
|
});
|
|
714
693
|
});
|
|
@@ -717,7 +696,7 @@ class FsAclEntriesComponent {
|
|
|
717
696
|
}
|
|
718
697
|
update(aclObjectEntry) {
|
|
719
698
|
const data = {
|
|
720
|
-
aclObjectEntry
|
|
699
|
+
aclObjectEntry,
|
|
721
700
|
required: false,
|
|
722
701
|
loadAclRoles: this.loadAclRoles,
|
|
723
702
|
saveAclObjectEntry: this.saveAclObjectEntry
|
|
@@ -740,7 +719,7 @@ class FsAclEntriesComponent {
|
|
|
740
719
|
}
|
|
741
720
|
}
|
|
742
721
|
FsAclEntriesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclEntriesComponent, deps: [{ token: FsAppAclService }, { token: i2.MatDialog }, { token: i3$1.FsPrompt }], target: i0.ɵɵFactoryTarget.Component });
|
|
743
|
-
FsAclEntriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclEntriesComponent, selector: "fs-acl-entries", inputs: { loadAclEntries: "loadAclEntries", loadAclRoles: "loadAclRoles", saveAclObjectEntry: "saveAclObjectEntry", environmentShow: "environmentShow", environmentLabel: "environmentLabel", actions: "actions" }, viewQueries: [{ propertyName: "aclEntriesList", first: true, predicate: FsListComponent, descendants: true }], ngImport: i0, template: "\n<fs-list [config]=\"aclEntriesConfig\">\n <fs-list-column>\n <ng-template fs-list-header>Context</ng-template>\n <ng-template fs-list-cell let-row=\"row\">\n <div\n
|
|
722
|
+
FsAclEntriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclEntriesComponent, selector: "fs-acl-entries", inputs: { loadAclEntries: "loadAclEntries", loadAclRoles: "loadAclRoles", saveAclObjectEntry: "saveAclObjectEntry", environmentShow: "environmentShow", environmentLabel: "environmentLabel", environmentKey: "environmentKey", actions: "actions" }, viewQueries: [{ propertyName: "aclEntriesList", first: true, predicate: FsListComponent, descendants: true }], ngImport: i0, template: "\n<fs-list [config]=\"aclEntriesConfig\">\n <fs-list-column>\n <ng-template fs-list-header>Context</ng-template>\n <ng-template fs-list-cell let-row=\"row\">\n <div\n *ngIf=\"row.object; else elseObject\"\n fxLayout=\"row\"\n fxLayoutAlign=\"start center\"\n fxLayoutGap=\"10px\">\n <fs-badge *ngIf=\"row.object.imageUrl\" shape=\"circle\" image=\"{{ row.object.imageUrl }}\"></fs-badge>\n <span>\n <div><small>{{ row.object.className }}</small></div>\n <a (click)=\"update(row)\">{{ row.object.name }}</a>\n </span>\n </div>\n\n <ng-template #elseObject>\n <a (click)=\"update(row)\">App</a>\n </ng-template>\n </ng-template>\n </fs-list-column>\n\n <fs-list-column [show]=\"environmentShow\">\n <ng-template fs-list-header>{{environmentLabel}}</ng-template>\n <ng-template fs-list-cell let-row=\"row\">\n {{row.environment?.name}}\n </ng-template>\n </fs-list-column>\n\n <fs-list-column>\n <ng-template fs-list-header>Roles</ng-template>\n <ng-template fs-list-cell let-row=\"row\">\n <div fxLayout=\"column\" fxLayoutGap=\"10px\">\n <div div *ngFor=\"let aclEntry of row.aclEntries\">\n <ng-container [ngSwitch]=\"row.level\">\n <ng-container *ngSwitchCase=\"'app'\">\n <fs-acl-role-popover [aclRole]=\"aclEntry.aclRole\" objectName=\"App\">{{aclEntry.aclRole.name}}</fs-acl-role-popover>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <ng-container *ngIf=\"row.object\">\n <fs-acl-role-popover [aclRole]=\"aclEntry.aclRole\">{{aclEntry.aclRole.name}}</fs-acl-role-popover>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n </ng-template>\n </fs-list-column>\n</fs-list>\n", styles: [""], components: [{ type: i12.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }, { type: i5$1.FsBadgeComponent, selector: "fs-badge", inputs: ["color", "text", "tooltip", "size", "shape", "image", "icon", "iconSize", "iconColor", "backgroundSize"] }, { type: FsAclRolePopoverComponent, selector: "fs-acl-role-popover", inputs: ["aclRole", "objectName"] }], directives: [{ type: i12.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i12.FsListHeaderDirective, selector: "[fs-list-header]", inputs: ["colspan", "align", "class"] }, { type: i12.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }, { type: i7$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i17.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { type: i17.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { type: i17.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { type: i7$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i7$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }] });
|
|
744
723
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclEntriesComponent, decorators: [{
|
|
745
724
|
type: Component,
|
|
746
725
|
args: [{
|
|
@@ -758,6 +737,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
758
737
|
type: Input
|
|
759
738
|
}], environmentLabel: [{
|
|
760
739
|
type: Input
|
|
740
|
+
}], environmentKey: [{
|
|
741
|
+
type: Input
|
|
761
742
|
}], actions: [{
|
|
762
743
|
type: Input
|
|
763
744
|
}], aclEntriesList: [{
|