@firestitch/app-acl 12.3.0 → 12.3.3

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 (53) hide show
  1. package/app/components/acl-entries/acl-entries.component.d.ts +33 -32
  2. package/app/components/acl-entry/acl-entry.component.d.ts +31 -29
  3. package/app/components/acl-object-roles/acl-object-roles.component.d.ts +18 -18
  4. package/app/components/acl-permission-popover/acl-permission-popover.component.d.ts +12 -12
  5. package/app/components/acl-role/acl-role.component.d.ts +46 -46
  6. package/app/components/acl-role-popover/acl-role-popover.component.d.ts +13 -13
  7. package/app/components/acl-roles/acl-roles.component.d.ts +35 -35
  8. package/app/consts/acl-role-accesses.d.ts +5 -5
  9. package/app/enums/acl-role-access.d.ts +6 -6
  10. package/app/fs-app-acl.module.d.ts +31 -31
  11. package/app/injectors/app-acl-config.injector.d.ts +2 -2
  12. package/app/interfaces/acl-entry-data.d.ts +11 -11
  13. package/app/interfaces/acl-entry.d.ts +18 -18
  14. package/app/interfaces/acl-level.d.ts +3 -3
  15. package/app/interfaces/acl-object-entry.d.ts +11 -11
  16. package/app/interfaces/acl-object-role.d.ts +6 -6
  17. package/app/interfaces/acl-object.d.ts +4 -4
  18. package/app/interfaces/acl-permission.d.ts +7 -7
  19. package/app/interfaces/acl-role.d.ts +15 -15
  20. package/app/interfaces/app-acl-config.d.ts +7 -7
  21. package/app/interfaces/name-value.d.ts +4 -4
  22. package/app/services/app-acl.service.d.ts +16 -18
  23. package/bundles/firestitch-app-acl.umd.js +1138 -1160
  24. package/bundles/firestitch-app-acl.umd.js.map +1 -1
  25. package/esm2015/app/components/acl-entries/acl-entries.component.js +173 -166
  26. package/esm2015/app/components/acl-entry/acl-entry.component.js +90 -93
  27. package/esm2015/app/components/acl-object-roles/acl-object-roles.component.js +56 -56
  28. package/esm2015/app/components/acl-permission-popover/acl-permission-popover.component.js +32 -32
  29. package/esm2015/app/components/acl-role/acl-role.component.js +201 -202
  30. package/esm2015/app/components/acl-role-popover/acl-role-popover.component.js +37 -37
  31. package/esm2015/app/components/acl-roles/acl-roles.component.js +146 -146
  32. package/esm2015/app/consts/acl-role-accesses.js +7 -7
  33. package/esm2015/app/enums/acl-role-access.js +7 -7
  34. package/esm2015/app/fs-app-acl.module.js +123 -123
  35. package/esm2015/app/injectors/app-acl-config.injector.js +2 -2
  36. package/esm2015/app/interfaces/acl-entry-data.js +1 -1
  37. package/esm2015/app/interfaces/acl-entry.js +1 -1
  38. package/esm2015/app/interfaces/acl-level.js +1 -1
  39. package/esm2015/app/interfaces/acl-object-entry.js +1 -1
  40. package/esm2015/app/interfaces/acl-object-role.js +1 -1
  41. package/esm2015/app/interfaces/acl-object.js +1 -1
  42. package/esm2015/app/interfaces/acl-permission.js +1 -1
  43. package/esm2015/app/interfaces/acl-role.js +1 -1
  44. package/esm2015/app/interfaces/app-acl-config.js +1 -1
  45. package/esm2015/app/interfaces/name-value.js +1 -1
  46. package/esm2015/app/services/app-acl.service.js +51 -78
  47. package/esm2015/firestitch-app-acl.js +4 -4
  48. package/esm2015/public_api.js +10 -10
  49. package/fesm2015/firestitch-app-acl.js +777 -799
  50. package/fesm2015/firestitch-app-acl.js.map +1 -1
  51. package/firestitch-app-acl.d.ts +5 -5
  52. package/package.json +1 -1
  53. package/public_api.d.ts +20 -20
@@ -36,837 +36,815 @@ 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
- var AclRoleAccess;
51
- (function (AclRoleAccess) {
52
- AclRoleAccess[AclRoleAccess["None"] = 0] = "None";
53
- AclRoleAccess[AclRoleAccess["Read"] = 5] = "Read";
54
- AclRoleAccess[AclRoleAccess["Write"] = 10] = "Write";
55
- AclRoleAccess[AclRoleAccess["Full"] = 15] = "Full";
48
+ var AclRoleAccess;
49
+ (function (AclRoleAccess) {
50
+ AclRoleAccess[AclRoleAccess["None"] = 0] = "None";
51
+ AclRoleAccess[AclRoleAccess["Read"] = 5] = "Read";
52
+ AclRoleAccess[AclRoleAccess["Write"] = 10] = "Write";
53
+ AclRoleAccess[AclRoleAccess["Full"] = 15] = "Full";
56
54
  })(AclRoleAccess || (AclRoleAccess = {}));
57
55
 
58
- const AclRoleAccesses = [
59
- { name: 'None', value: AclRoleAccess.None },
60
- { name: 'Read', value: AclRoleAccess.Read },
61
- { name: 'Write', value: AclRoleAccess.Write },
62
- { name: 'Full', value: AclRoleAccess.Full }
56
+ const AclRoleAccesses = [
57
+ { name: 'None', value: AclRoleAccess.None },
58
+ { name: 'Read', value: AclRoleAccess.Read },
59
+ { name: 'Write', value: AclRoleAccess.Write },
60
+ { name: 'Full', value: AclRoleAccess.Full }
63
61
  ];
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
- class FsAppAclService {
70
- constructor(_appAclConfig) {
71
- this._appAclConfig = _appAclConfig;
72
- }
73
- getPermissions() {
74
- if (!this._permissions$) {
75
- this._permissions$ = new ReplaySubject();
76
- this._appAclConfig.permissions
77
- .pipe(map((data) => this.input(data)))
78
- .subscribe((permissions) => {
79
- this._permissions$.next(permissions);
80
- this._permissions$.complete();
81
- });
82
- }
83
- return this._permissions$;
84
- }
85
- getLevels() {
86
- if (!this._levels$) {
87
- this._levels$ = new ReplaySubject();
88
- this._appAclConfig.levels
89
- .pipe(map((data) => this.input(data)))
90
- .subscribe((levels) => {
91
- this._levels$.next(levels);
92
- this._levels$.complete();
93
- });
94
- }
95
- return this._levels$;
96
- }
97
- getIndexedLevels() {
98
- return this.getLevels()
99
- .pipe(map((data) => {
100
- return list(data, 'name', 'value');
101
- }));
102
- }
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
- }
124
- 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
- FsAppAclService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclService, providedIn: 'root' });
126
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclService, decorators: [{
127
- type: Injectable,
128
- args: [{
129
- providedIn: 'root',
130
- }]
131
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
132
- type: Inject,
133
- args: [FS_APP_ACL_CONFIG]
65
+ class FsAppAclService {
66
+ constructor(_appAclConfig) {
67
+ this._appAclConfig = _appAclConfig;
68
+ }
69
+ getPermissions() {
70
+ if (!this._permissions$) {
71
+ this._permissions$ = new ReplaySubject();
72
+ this._appAclConfig.permissions
73
+ .subscribe((permissions) => {
74
+ this._permissions$.next(permissions);
75
+ this._permissions$.complete();
76
+ });
77
+ }
78
+ return this._permissions$;
79
+ }
80
+ getLevels() {
81
+ if (!this._levels$) {
82
+ this._levels$ = new ReplaySubject();
83
+ this._appAclConfig.levels
84
+ .subscribe((levels) => {
85
+ this._levels$.next(levels);
86
+ this._levels$.complete();
87
+ });
88
+ }
89
+ return this._levels$;
90
+ }
91
+ getIndexedLevels() {
92
+ return this.getLevels()
93
+ .pipe(map((data) => {
94
+ return list(data, 'name', 'value');
95
+ }));
96
+ }
97
+ }
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 });
99
+ FsAppAclService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclService, providedIn: 'root' });
100
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclService, decorators: [{
101
+ type: Injectable,
102
+ args: [{
103
+ providedIn: 'root',
104
+ }]
105
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
106
+ type: Inject,
107
+ args: [FS_APP_ACL_CONFIG]
134
108
  }] }]; } });
135
109
 
136
- class FsAclRoleComponent {
137
- constructor(_appAclService, _dialogRef, _message, _data, _cdRef) {
138
- this._appAclService = _appAclService;
139
- this._dialogRef = _dialogRef;
140
- this._message = _message;
141
- this._data = _data;
142
- this._cdRef = _cdRef;
143
- this.aclRole = null;
144
- this.permissions = [];
145
- this.levelPermissions = [];
146
- this.AclRoleAccesses = AclRoleAccesses;
147
- this.indexedAccesses = {};
148
- this.aclLevels = [];
149
- this.indexedAclLevels = {};
150
- this.onlyFullAccess = false;
151
- this.AclLevels = {};
152
- this.aclRoleConfigs = [];
153
- this.levelAclRoleConfigs = [];
154
- this._destroy$ = new Subject();
155
- this.save = () => {
156
- const aclRole = Object.assign(Object.assign({}, this.aclRole), { permissions: this.levelPermissions.map((permission) => {
157
- return {
158
- value: permission.value,
159
- access: this.aclRole.permissions[permission.value] || 0,
160
- };
161
- }), aclRoleConfigs: this.levelAclRoleConfigs.map((item) => {
162
- return {
163
- id: item.id,
164
- value: item.value,
165
- data: item.data,
166
- };
167
- }) });
168
- return this._data.saveAclRole(this._appAclService.output(aclRole))
169
- .pipe(tap((response) => {
170
- this._message.success('Saved Changes');
171
- this.close(response);
172
- }));
173
- };
174
- }
175
- ngOnInit() {
176
- forkJoin(this.getRole(), this._appAclService.getPermissions())
177
- .pipe(takeUntil(this._destroy$))
178
- .subscribe(([aclRole, aclPermissions,]) => {
179
- this.permissions = aclPermissions;
180
- this.aclLevels = this._data.aclLevels;
181
- this.indexedAclLevels = list(this.aclLevels, 'name', 'value');
182
- this.indexedAccesses = list(AclRoleAccesses, 'name', 'value');
183
- this.aclRole = Object.assign({
184
- aclPermissions: [],
185
- allPermissions: true,
186
- aclRoleConfigs: [],
187
- permissions: {},
188
- level: this.aclLevels[0].value,
189
- }, aclRole);
190
- if (this.aclRole.id) {
191
- this.permissions.forEach((permission) => {
192
- let access = 0;
193
- const aclPermission = this.aclRole.aclPermissions.find((item) => {
194
- return item.permission === permission.value;
195
- });
196
- if (aclPermission) {
197
- access = aclPermission.access;
198
- }
199
- this.aclRole.permissions[permission.value] = access;
200
- });
201
- }
202
- if (this.aclRole.allPermissions) {
203
- this._applyMaxPermissionAccess();
204
- }
205
- this._updatePermissions();
206
- this._updateAclRoleConfigs();
207
- this._cdRef.markForCheck();
208
- });
209
- this.listConfig = {
210
- status: false,
211
- paging: false,
212
- noResults: {
213
- message: '',
214
- },
215
- group: {
216
- initialExpand: true,
217
- groupBy: (data) => {
218
- return data;
219
- },
220
- compareBy: (data) => {
221
- return data.category || 'General';
222
- },
223
- },
224
- fetch: () => {
225
- return of({
226
- data: this.levelPermissions.sort((a, b) => {
227
- a = a.name.toUpperCase();
228
- b = b.name.toUpperCase();
229
- if (a < b) {
230
- return -1;
231
- }
232
- else if (a > b) {
233
- return 1;
234
- }
235
- return 0;
236
- }),
237
- });
238
- },
239
- };
240
- }
241
- levelChange() {
242
- this._updatePermissions();
243
- this._updateAclRoleConfigs();
244
- setTimeout(() => {
245
- this.list.reload();
246
- });
247
- }
248
- getRole() {
249
- if (!this._data.aclRole.id) {
250
- return of(this._data.aclRole);
251
- }
252
- const query = {
253
- aclPermissions: true,
254
- aclRoleConfigs: true,
255
- };
256
- if (!this.environment) {
257
- query.environmentId = null;
258
- }
259
- return this._data.loadAclRole(this._data.aclRole, query)
260
- .pipe(map((data) => this._appAclService.input(data)));
261
- }
262
- close(data = null) {
263
- this._dialogRef.close(data);
264
- }
265
- allPermissionsChange(all) {
266
- this._updatePermissions();
267
- if (all) {
268
- this._applyMaxPermissionAccess();
269
- }
270
- }
271
- ngOnDestroy() {
272
- this._destroy$.next();
273
- this._destroy$.complete();
274
- }
275
- _updatePermissions() {
276
- this.levelPermissions = this.permissions.filter((permission) => {
277
- return permission.levels.some((item) => {
278
- return item === this.aclRole.level;
279
- });
280
- });
281
- }
282
- _updateAclRoleConfigs() {
283
- this.levelAclRoleConfigs = this.aclRoleConfigs.filter((item) => {
284
- return this.aclRole.level === item.level;
285
- });
286
- }
287
- _applyMaxPermissionAccess() {
288
- this.permissions.forEach((permission) => {
289
- this.aclRole.permissions[permission.value] = Math.max(...permission.accesses);
290
- });
291
- }
292
- }
293
- FsAclRoleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRoleComponent, deps: [{ token: FsAppAclService }, { token: i2.MatDialogRef }, { token: i3.FsMessage }, { token: MAT_DIALOG_DATA }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
294
- FsAclRoleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclRoleComponent, selector: "ng-component", viewQueries: [{ propertyName: "list", first: true, predicate: FsListComponent, descendants: true }], ngImport: i0, template: "<form fsForm [submit]=\"save\">\n <fs-dialog>\n <ng-container *ngIf=\"aclRole\">\n <div mat-dialog-title>{{ aclRole.id ? 'Edit' : 'Create' }} Role</div>\n <mat-dialog-content>\n <div fxLayout=\"row\" fxLayout.lt-md=\"column\" fxLayoutGap=\"40px\" fxLayoutGap.lt-md=\"0\">\n <div fxLayout=\"column\" fxFlex fxFlex.lt-md=\"0\">\n <mat-form-field>\n <input matInput placeholder=\"Name\" [(ngModel)]=\"aclRole.name\" name=\"name\" fsFormRequired>\n </mat-form-field>\n\n <fs-label-field *ngIf=\"aclRole.id || aclLevels.length === 1; else levels\">\n <fs-label>Level</fs-label>\n {{indexedAclLevels[aclRole.level]}}\n </fs-label-field>\n\n <ng-template #levels>\n <div class=\"level\">\n <fs-radio-group\n [(ngModel)]=\"aclRole.level\"\n (ngModelChange)=\"levelChange()\"\n fsFormRequired\n label=\"Level\"\n orientation=\"vertical\"\n name=\"level\">\n <mat-radio-button\n *ngFor=\"let item of aclLevels\"\n [value]=\"item.value\"\n [disabled]=\"!!aclRole.protected\">\n {{ item.name }}\n </mat-radio-button>\n </fs-radio-group>\n </div>\n </ng-template>\n\n <fs-label-field *ngIf=\"levelPermissions.length\">\n <fs-label>All Permissions</fs-label>\n <mat-checkbox\n [(ngModel)]=\"aclRole.allPermissions\"\n (ngModelChange)=\"allPermissionsChange($event)\"\n [disabled]=\"!!aclRole.protected\"\n name=\"allPermissions\">\n </mat-checkbox>\n </fs-label-field>\n\n <div fxLayout=\"column\" *ngFor=\"let config of levelAclRoleConfigs\">\n <fs-label-field *ngIf=\"config.interface === 'checkbox'\">\n <fs-label>{{config.name}}</fs-label>\n <mat-checkbox\n [(ngModel)]=\"config.data\"\n [name]=\"config.name\">\n </mat-checkbox>\n <fs-label-message>\n <mat-hint>{{config.description}}</mat-hint>\n </fs-label-message>\n </fs-label-field>\n\n <mat-form-field *ngIf=\"config.interface === 'select'\">\n <mat-select\n [(ngModel)]=\"config.data\"\n [name]=\"config.value\"\n [required]=\"config.required\"\n [placeholder]=\"config.name\">\n <mat-option\n *ngFor=\"let item of config.values\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n <mat-hint>{{config.description}}</mat-hint>\n </mat-form-field>\n </div>\n </div>\n\n <div fxLayout=\"column\" fxFlex=\"65\" fxFlex.lt-md=\"0\" *ngIf=\"aclRole.level\" [hidden]=\"!levelPermissions.length\" class=\"permissions\">\n\n <fs-list [config]=\"listConfig\">\n <fs-list-column title=\"Permissions\">\n <ng-template colspan=\"2\" fs-list-group-cell let-row=\"row\" class=\"permission-group\">\n <small><b>{{row.category || 'General'}}</b></small>\n </ng-template>\n <ng-template fs-list-cell let-row=\"row\">\n <div class=\"permission\">{{ row.name }}</div>\n <div class=\"description small\">{{ row.description }}</div>\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Access\" width=\"1%\" class=\"access\">\n <ng-template fs-list-cell let-row=\"permission\" let-permission=\"row\">\n <span *ngIf=\"aclRole.allPermissions; else elseAll\">\n {{ indexedAccesses[aclRole.permissions[permission.value]] }}\n </span>\n <ng-template #elseAll>\n <mat-form-field>\n <mat-select\n [(ngModel)]=\"aclRole.permissions[permission.value]\"\n [disabled]=\"!!aclRole.protected\"\n fsFormRequired\n name=\"access-{{ permission.value }}\">\n <ng-container *ngFor=\"let access of AclRoleAccesses\">\n <mat-option\n *ngIf=\"access.value === 0 || permission.accesses.indexOf(access.value) !== -1\"\n [value]=\"access.value\">\n {{ access.name }}\n </mat-option>\n </ng-container>\n </mat-select>\n </mat-form-field>\n </ng-template>\n </ng-template>\n </fs-list-column>\n </fs-list>\n </div>\n </div>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button type=\"submit\" color=\"primary\">{{ aclRole.id ? 'Save' : 'Create' }}</button>\n <button mat-button [mat-dialog-close]=\"null\" type=\"button\">Cancel</button>\n </mat-dialog-actions>\n </ng-container>\n </fs-dialog>\n</form>\n", styles: [":host .permissions ::ng-deep .fs-list-row-group{background-color:#f6f6f6}:host .permissions ::ng-deep fs-list .access{white-space:nowrap}:host .permissions ::ng-deep .mat-form-field{width:100px}:host .permissions ::ng-deep .mat-form-field .mat-form-field-wrapper{padding-bottom:0}:host .permissions ::ng-deep .mat-form-field .mat-form-field-infix{border-top:0}:host .permissions ::ng-deep .mat-form-field .mat-form-field-underline{bottom:0}:host ::ng-deep fs-radio-group{width:100%}:host ::ng-deep fs-label-field{width:100%}:host .level{width:100%}\n"], components: [{ type: i4.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i6.FsLabelFieldComponent, selector: "fs-label-field", inputs: ["bottomMargin", "topMargin", "labelMargin"] }, { type: i6.FsLabelComponent, selector: "fs-label" }, { type: i7.FsRadioGroupComponent, selector: "fs-radio-group", inputs: ["orientation", "label", "name", "disabled", "radioPosition", "compareWith", "required"] }, { type: i8.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }, { type: i9.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i6.FsLabelMessageComponent, selector: "fs-label-message" }, { type: i10.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i11.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i12.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }, { type: i13.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i14.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i14.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i14.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i15.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"] }, { type: i7$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { 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.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: i17.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { type: i18.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i14.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i15.FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: ["fsFormRequired", "required", "fsFormRequiredMessage"] }, { type: i14.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { type: i14.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i12.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i12.FsListGroupHeaderDirective, selector: "[fs-list-group-cell],[fs-list-group-header]" }, { type: i12.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }, { type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i15.FsSubmitButtonDirective, selector: "button[type=\"submit\"]", inputs: ["name", "dirtySubmit"] }, { type: i2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
295
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRoleComponent, decorators: [{
296
- type: Component,
297
- args: [{
298
- templateUrl: './acl-role.component.html',
299
- styleUrls: ['./acl-role.component.scss'],
300
- changeDetection: ChangeDetectionStrategy.OnPush,
301
- }]
302
- }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialogRef }, { type: i3.FsMessage }, { type: undefined, decorators: [{
303
- type: Inject,
304
- args: [MAT_DIALOG_DATA]
305
- }] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { list: [{
306
- type: ViewChild,
307
- args: [FsListComponent]
110
+ class FsAclRoleComponent {
111
+ constructor(_appAclService, _dialogRef, _message, _data, _cdRef) {
112
+ this._appAclService = _appAclService;
113
+ this._dialogRef = _dialogRef;
114
+ this._message = _message;
115
+ this._data = _data;
116
+ this._cdRef = _cdRef;
117
+ this.aclRole = null;
118
+ this.permissions = [];
119
+ this.levelPermissions = [];
120
+ this.AclRoleAccesses = AclRoleAccesses;
121
+ this.indexedAccesses = {};
122
+ this.aclLevels = [];
123
+ this.indexedAclLevels = {};
124
+ this.onlyFullAccess = false;
125
+ this.AclLevels = {};
126
+ this.aclRoleConfigs = [];
127
+ this.levelAclRoleConfigs = [];
128
+ this._destroy$ = new Subject();
129
+ this.save = () => {
130
+ const aclRole = Object.assign(Object.assign({}, this.aclRole), { permissions: this.levelPermissions.map((permission) => {
131
+ return {
132
+ value: permission.value,
133
+ access: this.aclRole.permissions[permission.value] || 0,
134
+ };
135
+ }), aclRoleConfigs: this.levelAclRoleConfigs.map((item) => {
136
+ return {
137
+ id: item.id,
138
+ value: item.value,
139
+ data: item.data,
140
+ };
141
+ }) });
142
+ return this._data.saveAclRole(aclRole)
143
+ .pipe(tap((response) => {
144
+ this._message.success('Saved Changes');
145
+ this.close(response);
146
+ }));
147
+ };
148
+ }
149
+ ngOnInit() {
150
+ forkJoin(this.getRole(), this._appAclService.getPermissions())
151
+ .pipe(takeUntil(this._destroy$))
152
+ .subscribe(([aclRole, aclPermissions,]) => {
153
+ this.permissions = aclPermissions;
154
+ this.aclLevels = this._data.aclLevels;
155
+ this.indexedAclLevels = list(this.aclLevels, 'name', 'value');
156
+ this.indexedAccesses = list(AclRoleAccesses, 'name', 'value');
157
+ this.aclRole = Object.assign({
158
+ aclPermissions: [],
159
+ allPermissions: true,
160
+ aclRoleConfigs: [],
161
+ permissions: {},
162
+ level: this.aclLevels[0].value,
163
+ }, aclRole);
164
+ if (this.aclRole.id) {
165
+ this.permissions.forEach((permission) => {
166
+ let access = 0;
167
+ const aclPermission = this.aclRole.aclPermissions.find((item) => {
168
+ return item.permission === permission.value;
169
+ });
170
+ if (aclPermission) {
171
+ access = aclPermission.access;
172
+ }
173
+ this.aclRole.permissions[permission.value] = access;
174
+ });
175
+ }
176
+ if (this.aclRole.allPermissions) {
177
+ this._applyMaxPermissionAccess();
178
+ }
179
+ this._updatePermissions();
180
+ this._updateAclRoleConfigs();
181
+ this._cdRef.markForCheck();
182
+ });
183
+ this.listConfig = {
184
+ status: false,
185
+ paging: false,
186
+ noResults: {
187
+ message: '',
188
+ },
189
+ group: {
190
+ initialExpand: true,
191
+ groupBy: (data) => {
192
+ return data;
193
+ },
194
+ compareBy: (data) => {
195
+ return data.category || 'General';
196
+ },
197
+ },
198
+ fetch: () => {
199
+ return of({
200
+ data: this.levelPermissions.sort((a, b) => {
201
+ a = a.name.toUpperCase();
202
+ b = b.name.toUpperCase();
203
+ if (a < b) {
204
+ return -1;
205
+ }
206
+ else if (a > b) {
207
+ return 1;
208
+ }
209
+ return 0;
210
+ }),
211
+ });
212
+ },
213
+ };
214
+ }
215
+ levelChange() {
216
+ this._updatePermissions();
217
+ this._updateAclRoleConfigs();
218
+ setTimeout(() => {
219
+ this.list.reload();
220
+ });
221
+ }
222
+ getRole() {
223
+ if (!this._data.aclRole.id) {
224
+ return of(this._data.aclRole);
225
+ }
226
+ const query = {
227
+ aclPermissions: true,
228
+ aclRoleConfigs: true,
229
+ };
230
+ if (!this.environment) {
231
+ query.environmentId = null;
232
+ }
233
+ return this._data.loadAclRole(this._data.aclRole, query);
234
+ }
235
+ close(data = null) {
236
+ this._dialogRef.close(data);
237
+ }
238
+ allPermissionsChange(all) {
239
+ this._updatePermissions();
240
+ if (all) {
241
+ this._applyMaxPermissionAccess();
242
+ }
243
+ }
244
+ ngOnDestroy() {
245
+ this._destroy$.next();
246
+ this._destroy$.complete();
247
+ }
248
+ _updatePermissions() {
249
+ this.levelPermissions = this.permissions.filter((permission) => {
250
+ return permission.levels.some((item) => {
251
+ return item === this.aclRole.level;
252
+ });
253
+ });
254
+ }
255
+ _updateAclRoleConfigs() {
256
+ this.levelAclRoleConfigs = this.aclRoleConfigs.filter((item) => {
257
+ return this.aclRole.level === item.level;
258
+ });
259
+ }
260
+ _applyMaxPermissionAccess() {
261
+ this.permissions.forEach((permission) => {
262
+ this.aclRole.permissions[permission.value] = Math.max(...permission.accesses);
263
+ });
264
+ }
265
+ }
266
+ FsAclRoleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRoleComponent, deps: [{ token: FsAppAclService }, { token: i2.MatDialogRef }, { token: i3.FsMessage }, { token: MAT_DIALOG_DATA }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
267
+ FsAclRoleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclRoleComponent, selector: "ng-component", viewQueries: [{ propertyName: "list", first: true, predicate: FsListComponent, descendants: true }], ngImport: i0, template: "<form fsForm [submit]=\"save\">\n <fs-dialog>\n <ng-container *ngIf=\"aclRole\">\n <div mat-dialog-title>{{ aclRole.id ? 'Edit' : 'Create' }} Role</div>\n <mat-dialog-content>\n <div fxLayout=\"row\" fxLayout.lt-md=\"column\" fxLayoutGap=\"40px\" fxLayoutGap.lt-md=\"0\">\n <div fxLayout=\"column\" fxFlex fxFlex.lt-md=\"0\">\n <mat-form-field>\n <input matInput placeholder=\"Name\" [(ngModel)]=\"aclRole.name\" name=\"name\" fsFormRequired>\n </mat-form-field>\n\n <fs-label-field *ngIf=\"aclRole.id || aclLevels.length === 1; else levels\">\n <fs-label>Level</fs-label>\n {{indexedAclLevels[aclRole.level]}}\n </fs-label-field>\n\n <ng-template #levels>\n <div class=\"level\">\n <fs-radio-group\n [(ngModel)]=\"aclRole.level\"\n (ngModelChange)=\"levelChange()\"\n fsFormRequired\n label=\"Level\"\n orientation=\"vertical\"\n name=\"level\">\n <mat-radio-button\n *ngFor=\"let item of aclLevels\"\n [value]=\"item.value\"\n [disabled]=\"!!aclRole.protected\">\n {{ item.name }}\n </mat-radio-button>\n </fs-radio-group>\n </div>\n </ng-template>\n\n <fs-label-field *ngIf=\"levelPermissions.length\">\n <fs-label>All Permissions</fs-label>\n <mat-checkbox\n [(ngModel)]=\"aclRole.allPermissions\"\n (ngModelChange)=\"allPermissionsChange($event)\"\n [disabled]=\"!!aclRole.protected\"\n name=\"allPermissions\">\n </mat-checkbox>\n </fs-label-field>\n\n <div fxLayout=\"column\" *ngFor=\"let config of levelAclRoleConfigs\">\n <fs-label-field *ngIf=\"config.interface === 'checkbox'\">\n <fs-label>{{config.name}}</fs-label>\n <mat-checkbox\n [(ngModel)]=\"config.data\"\n [name]=\"config.name\">\n </mat-checkbox>\n <fs-label-message>\n <mat-hint>{{config.description}}</mat-hint>\n </fs-label-message>\n </fs-label-field>\n\n <mat-form-field *ngIf=\"config.interface === 'select'\">\n <mat-select\n [(ngModel)]=\"config.data\"\n [name]=\"config.value\"\n [required]=\"config.required\"\n [placeholder]=\"config.name\">\n <mat-option\n *ngFor=\"let item of config.values\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n <mat-hint>{{config.description}}</mat-hint>\n </mat-form-field>\n </div>\n </div>\n\n <div fxLayout=\"column\" fxFlex=\"65\" fxFlex.lt-md=\"0\" *ngIf=\"aclRole.level\" [hidden]=\"!levelPermissions.length\" class=\"permissions\">\n\n <fs-list [config]=\"listConfig\">\n <fs-list-column title=\"Permissions\">\n <ng-template colspan=\"2\" fs-list-group-cell let-row=\"row\" class=\"permission-group\">\n <small><b>{{row.category || 'General'}}</b></small>\n </ng-template>\n <ng-template fs-list-cell let-row=\"row\">\n <div class=\"permission\">{{ row.name }}</div>\n <div class=\"description small\">{{ row.description }}</div>\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Access\" width=\"1%\" class=\"access\">\n <ng-template fs-list-cell let-row=\"permission\" let-permission=\"row\">\n <span *ngIf=\"aclRole.allPermissions; else elseAll\">\n {{ indexedAccesses[aclRole.permissions[permission.value]] }}\n </span>\n <ng-template #elseAll>\n <mat-form-field>\n <mat-select\n [(ngModel)]=\"aclRole.permissions[permission.value]\"\n [disabled]=\"!!aclRole.protected\"\n fsFormRequired\n name=\"access-{{ permission.value }}\">\n <ng-container *ngFor=\"let access of AclRoleAccesses\">\n <mat-option\n *ngIf=\"access.value === 0 || permission.accesses.indexOf(access.value) !== -1\"\n [value]=\"access.value\">\n {{ access.name }}\n </mat-option>\n </ng-container>\n </mat-select>\n </mat-form-field>\n </ng-template>\n </ng-template>\n </fs-list-column>\n </fs-list>\n </div>\n </div>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button type=\"submit\" color=\"primary\">{{ aclRole.id ? 'Save' : 'Create' }}</button>\n <button mat-button [mat-dialog-close]=\"null\" type=\"button\">Cancel</button>\n </mat-dialog-actions>\n </ng-container>\n </fs-dialog>\n</form>\n", styles: [":host .permissions ::ng-deep .fs-list-row-group{background-color:#f6f6f6}:host .permissions ::ng-deep fs-list .access{white-space:nowrap}:host .permissions ::ng-deep .mat-form-field{width:100px}:host .permissions ::ng-deep .mat-form-field .mat-form-field-wrapper{padding-bottom:0}:host .permissions ::ng-deep .mat-form-field .mat-form-field-infix{border-top:0}:host .permissions ::ng-deep .mat-form-field .mat-form-field-underline{bottom:0}:host ::ng-deep fs-radio-group{width:100%}:host ::ng-deep fs-label-field{width:100%}:host .level{width:100%}\n"], components: [{ type: i4.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i6.FsLabelFieldComponent, selector: "fs-label-field", inputs: ["bottomMargin", "topMargin", "labelMargin"] }, { type: i6.FsLabelComponent, selector: "fs-label" }, { type: i7.FsRadioGroupComponent, selector: "fs-radio-group", inputs: ["orientation", "label", "name", "disabled", "radioPosition", "compareWith", "required"] }, { type: i8.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }, { type: i9.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i6.FsLabelMessageComponent, selector: "fs-label-message" }, { type: i10.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i11.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i12.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }, { type: i13.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i14.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i14.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i14.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i15.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"] }, { type: i7$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { 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.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: i17.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { type: i18.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i14.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i15.FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: ["fsFormRequired", "required", "fsFormRequiredMessage"] }, { type: i14.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { type: i14.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i12.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i12.FsListGroupHeaderDirective, selector: "[fs-list-group-cell],[fs-list-group-header]" }, { type: i12.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }, { type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i15.FsSubmitButtonDirective, selector: "button[type=\"submit\"]", inputs: ["name", "dirtySubmit"] }, { type: i2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
268
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRoleComponent, decorators: [{
269
+ type: Component,
270
+ args: [{
271
+ templateUrl: './acl-role.component.html',
272
+ styleUrls: ['./acl-role.component.scss'],
273
+ changeDetection: ChangeDetectionStrategy.OnPush,
274
+ }]
275
+ }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialogRef }, { type: i3.FsMessage }, { type: undefined, decorators: [{
276
+ type: Inject,
277
+ args: [MAT_DIALOG_DATA]
278
+ }] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { list: [{
279
+ type: ViewChild,
280
+ args: [FsListComponent]
308
281
  }] } });
309
282
 
310
- class FsAclPermissionPopoverComponent {
311
- constructor(_appAclService) {
312
- this._appAclService = _appAclService;
313
- }
314
- ngOnInit() {
315
- this._appAclService.getPermissions()
316
- .subscribe(permissions => {
317
- this.description = permissions.filter(item => {
318
- return item.value === this.permission.value;
319
- }).map(item => {
320
- return item.description;
321
- })[0];
322
- });
323
- }
324
- }
325
- FsAclPermissionPopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclPermissionPopoverComponent, deps: [{ token: FsAppAclService }], target: i0.ɵɵFactoryTarget.Component });
326
- FsAclPermissionPopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclPermissionPopoverComponent, selector: "acl-permission-popover", inputs: { permission: "permission" }, ngImport: i0, template: "\n<fs-popover [template]=\"popover\" maxWidth=\"400\">\n <ng-content></ng-content>\n</fs-popover>\n\n<ng-template #popover>\n {{permission.name}}\n <div class=\"small\">{{description}}</div>\n</ng-template>\n\n", styles: [":host{cursor:pointer}\n"], components: [{ type: i2$1.FsPopoverComponent, selector: "fs-popover", inputs: ["template", "data", "leaveDelay", "showDelay", "maxWidth", "wrapperClass", "autoShow", "autoClose", "loadingDiameter", "loading", "indication", "position", "theme", "size", "trigger"] }] });
327
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclPermissionPopoverComponent, decorators: [{
328
- type: Component,
329
- args: [{
330
- selector: 'acl-permission-popover',
331
- templateUrl: './acl-permission-popover.component.html',
332
- styleUrls: ['./acl-permission-popover.component.scss']
333
- }]
334
- }], ctorParameters: function () { return [{ type: FsAppAclService }]; }, propDecorators: { permission: [{
335
- type: Input
283
+ class FsAclPermissionPopoverComponent {
284
+ constructor(_appAclService) {
285
+ this._appAclService = _appAclService;
286
+ }
287
+ ngOnInit() {
288
+ this._appAclService.getPermissions()
289
+ .subscribe(permissions => {
290
+ this.description = permissions.filter(item => {
291
+ return item.value === this.permission.value;
292
+ }).map(item => {
293
+ return item.description;
294
+ })[0];
295
+ });
296
+ }
297
+ }
298
+ FsAclPermissionPopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclPermissionPopoverComponent, deps: [{ token: FsAppAclService }], target: i0.ɵɵFactoryTarget.Component });
299
+ FsAclPermissionPopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclPermissionPopoverComponent, selector: "acl-permission-popover", inputs: { permission: "permission" }, ngImport: i0, template: "\n<fs-popover [template]=\"popover\" maxWidth=\"400\">\n <ng-content></ng-content>\n</fs-popover>\n\n<ng-template #popover>\n {{permission.name}}\n <div class=\"small\">{{description}}</div>\n</ng-template>\n\n", styles: [":host{cursor:pointer}\n"], components: [{ type: i2$1.FsPopoverComponent, selector: "fs-popover", inputs: ["template", "data", "leaveDelay", "showDelay", "maxWidth", "wrapperClass", "autoShow", "autoClose", "loadingDiameter", "loading", "indication", "position", "theme", "size", "trigger"] }] });
300
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclPermissionPopoverComponent, decorators: [{
301
+ type: Component,
302
+ args: [{
303
+ selector: 'acl-permission-popover',
304
+ templateUrl: './acl-permission-popover.component.html',
305
+ styleUrls: ['./acl-permission-popover.component.scss']
306
+ }]
307
+ }], ctorParameters: function () { return [{ type: FsAppAclService }]; }, propDecorators: { permission: [{
308
+ type: Input
336
309
  }] } });
337
310
 
338
- class FsAclRolesComponent {
339
- constructor(_appAclService, _dialog, _cdRef) {
340
- this._appAclService = _appAclService;
341
- this._dialog = _dialog;
342
- this._cdRef = _cdRef;
343
- this.aclLevels = [];
344
- this.list = new QueryList();
345
- this.indexedAclRoleLevels = {};
346
- this._destroy$ = new Subject();
347
- }
348
- ngOnInit() {
349
- new Observable(observer => {
350
- if (this.aclLevels.length) {
351
- observer.next(this.aclLevels);
352
- observer.complete();
353
- }
354
- else {
355
- this._appAclService.getLevels()
356
- .subscribe((aclLevels) => {
357
- observer.next(aclLevels);
358
- observer.complete();
359
- });
360
- }
361
- })
362
- .subscribe((aclLevels) => {
363
- this.aclLevels = aclLevels;
364
- this.indexedAclRoleLevels = list(this.aclLevels, 'name', 'value');
365
- this._loadListConfig();
366
- });
367
- }
368
- openDialog(aclRole = { id: null }) {
369
- const dialogRef = this._dialog.open(FsAclRoleComponent, {
370
- width: '70%',
371
- data: {
372
- aclRole,
373
- aclLevels: this.aclLevels,
374
- loadAclRole: this.loadAclRole,
375
- saveAclRole: this.saveAclRole,
376
- },
377
- });
378
- dialogRef.afterClosed()
379
- .pipe(takeUntil(this._destroy$), filter((response) => !!response))
380
- .subscribe((response) => {
381
- this.list.forEach((list) => {
382
- list.reload();
383
- });
384
- });
385
- }
386
- ngOnDestroy() {
387
- this._destroy$.next();
388
- this._destroy$.complete();
389
- }
390
- _loadListConfig() {
391
- this.listConfig = {
392
- sort: { value: 'hierarchy' },
393
- filters: [
394
- {
395
- name: 'keyword',
396
- type: ItemType.Keyword,
397
- label: 'Search',
398
- },
399
- {
400
- name: 'level',
401
- label: 'Level',
402
- type: ItemType.Select,
403
- values: this.aclLevels,
404
- hide: this.aclLevels.length <= 1
405
- },
406
- {
407
- name: 'state',
408
- label: 'Show Deleted',
409
- type: ItemType.Checkbox,
410
- unchecked: 'active',
411
- checked: 'deleted',
412
- },
413
- ],
414
- actions: [
415
- {
416
- click: (event) => {
417
- this.openDialog();
418
- },
419
- label: 'Create',
420
- },
421
- ],
422
- rowActions: [
423
- {
424
- click: (data) => {
425
- return this.deleteAclRole(this._appAclService.output(data));
426
- },
427
- remove: {
428
- title: 'Confirm',
429
- template: 'Are you sure you would like to delete this role?',
430
- },
431
- menu: true,
432
- label: 'Delete',
433
- show: (row) => row.state !== 'deleted',
434
- },
435
- ],
436
- fetch: (query) => {
437
- query.permissions = true;
438
- return this.loadAclRoles(query)
439
- .pipe(map((data) => this._appAclService.input(data)));
440
- },
441
- };
442
- }
443
- }
444
- FsAclRolesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolesComponent, deps: [{ token: FsAppAclService }, { token: i2.MatDialog }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
445
- FsAclRolesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclRolesComponent, selector: "fs-acl-roles", inputs: { deleteAclRole: "deleteAclRole", saveAclRole: "saveAclRole", loadAclRoles: "loadAclRoles", loadAclRole: "loadAclRole", aclLevels: "aclLevels" }, viewQueries: [{ propertyName: "list", predicate: FsListComponent, descendants: true }], ngImport: i0, template: "<fs-list [config]=\"listConfig\" *ngIf=\"listConfig\">\n <fs-list-column title=\"Name\" name=\"name\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n <a (click)=\"openDialog(row)\">{{ row.name }}</a>\n </ng-template>\n </fs-list-column>\n <fs-list-column name=\"hierarchy\" title=\"Level\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n {{ indexedAclRoleLevels[row.level] }}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Permissions\">\n <ng-template fs-list-cell let-row=\"row\">\n <div class=\"permissions\">\n <ng-container *ngFor=\"let permission of row.permissions\">\n <span *ngIf=\"permission.access\" class=\"permission\">\n <acl-permission-popover [permission]=\"permission\">{{permission.name}}</acl-permission-popover>\n </span>\n </ng-container>\n </div>\n </ng-template>\n </fs-list-column>\n</fs-list>\n", styles: [".permissions .permission+.permission:before{content:\", \"}\n"], components: [{ type: i12.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }, { type: FsAclPermissionPopoverComponent, selector: "acl-permission-popover", inputs: ["permission"] }], directives: [{ type: i7$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i12.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i12.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }, { type: i7$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
446
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolesComponent, decorators: [{
447
- type: Component,
448
- args: [{
449
- selector: 'fs-acl-roles',
450
- templateUrl: 'acl-roles.component.html',
451
- styleUrls: ['acl-roles.component.scss'],
452
- changeDetection: ChangeDetectionStrategy.OnPush,
453
- }]
454
- }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialog }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { deleteAclRole: [{
455
- type: Input
456
- }], saveAclRole: [{
457
- type: Input
458
- }], loadAclRoles: [{
459
- type: Input
460
- }], loadAclRole: [{
461
- type: Input
462
- }], aclLevels: [{
463
- type: Input
464
- }], list: [{
465
- type: ViewChildren,
466
- args: [FsListComponent]
311
+ class FsAclRolesComponent {
312
+ constructor(_appAclService, _dialog, _cdRef) {
313
+ this._appAclService = _appAclService;
314
+ this._dialog = _dialog;
315
+ this._cdRef = _cdRef;
316
+ this.aclLevels = [];
317
+ this.list = new QueryList();
318
+ this.indexedAclRoleLevels = {};
319
+ this._destroy$ = new Subject();
320
+ }
321
+ ngOnInit() {
322
+ new Observable(observer => {
323
+ if (this.aclLevels.length) {
324
+ observer.next(this.aclLevels);
325
+ observer.complete();
326
+ }
327
+ else {
328
+ this._appAclService.getLevels()
329
+ .subscribe((aclLevels) => {
330
+ observer.next(aclLevels);
331
+ observer.complete();
332
+ });
333
+ }
334
+ })
335
+ .subscribe((aclLevels) => {
336
+ this.aclLevels = aclLevels;
337
+ this.indexedAclRoleLevels = list(this.aclLevels, 'name', 'value');
338
+ this._loadListConfig();
339
+ });
340
+ }
341
+ openDialog(aclRole = { id: null }) {
342
+ const dialogRef = this._dialog.open(FsAclRoleComponent, {
343
+ width: '70%',
344
+ data: {
345
+ aclRole,
346
+ aclLevels: this.aclLevels,
347
+ loadAclRole: this.loadAclRole,
348
+ saveAclRole: this.saveAclRole,
349
+ },
350
+ });
351
+ dialogRef.afterClosed()
352
+ .pipe(takeUntil(this._destroy$), filter((response) => !!response))
353
+ .subscribe((response) => {
354
+ this.list.forEach((list) => {
355
+ list.reload();
356
+ });
357
+ });
358
+ }
359
+ ngOnDestroy() {
360
+ this._destroy$.next();
361
+ this._destroy$.complete();
362
+ }
363
+ _loadListConfig() {
364
+ this.listConfig = {
365
+ sort: { value: 'hierarchy' },
366
+ filters: [
367
+ {
368
+ name: 'keyword',
369
+ type: ItemType.Keyword,
370
+ label: 'Search',
371
+ },
372
+ {
373
+ name: 'level',
374
+ label: 'Level',
375
+ type: ItemType.Select,
376
+ values: this.aclLevels,
377
+ hide: this.aclLevels.length <= 1
378
+ },
379
+ {
380
+ name: 'state',
381
+ label: 'Show Deleted',
382
+ type: ItemType.Checkbox,
383
+ unchecked: 'active',
384
+ checked: 'deleted',
385
+ },
386
+ ],
387
+ actions: [
388
+ {
389
+ click: (event) => {
390
+ this.openDialog();
391
+ },
392
+ label: 'Create',
393
+ },
394
+ ],
395
+ rowActions: [
396
+ {
397
+ click: (data) => {
398
+ return this.deleteAclRole(data);
399
+ },
400
+ remove: {
401
+ title: 'Confirm',
402
+ template: 'Are you sure you would like to delete this role?',
403
+ },
404
+ menu: true,
405
+ label: 'Delete',
406
+ show: (row) => row.state !== 'deleted',
407
+ },
408
+ ],
409
+ fetch: (query) => {
410
+ query.permissions = true;
411
+ return this.loadAclRoles(query)
412
+ .pipe(map((data) => data));
413
+ },
414
+ };
415
+ }
416
+ }
417
+ FsAclRolesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolesComponent, deps: [{ token: FsAppAclService }, { token: i2.MatDialog }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
418
+ FsAclRolesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclRolesComponent, selector: "fs-acl-roles", inputs: { deleteAclRole: "deleteAclRole", saveAclRole: "saveAclRole", loadAclRoles: "loadAclRoles", loadAclRole: "loadAclRole", aclLevels: "aclLevels" }, viewQueries: [{ propertyName: "list", predicate: FsListComponent, descendants: true }], ngImport: i0, template: "<fs-list [config]=\"listConfig\" *ngIf=\"listConfig\">\n <fs-list-column title=\"Name\" name=\"name\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n <a (click)=\"openDialog(row)\">{{ row.name }}</a>\n </ng-template>\n </fs-list-column>\n <fs-list-column name=\"hierarchy\" title=\"Level\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n {{ indexedAclRoleLevels[row.level] }}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Permissions\">\n <ng-template fs-list-cell let-row=\"row\">\n <div class=\"permissions\">\n <ng-container *ngFor=\"let permission of row.permissions\">\n <span *ngIf=\"permission.access\" class=\"permission\">\n <acl-permission-popover [permission]=\"permission\">{{permission.name}}</acl-permission-popover>\n </span>\n </ng-container>\n </div>\n </ng-template>\n </fs-list-column>\n</fs-list>\n", styles: [".permissions .permission+.permission:before{content:\", \"}\n"], components: [{ type: i12.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }, { type: FsAclPermissionPopoverComponent, selector: "acl-permission-popover", inputs: ["permission"] }], directives: [{ type: i7$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i12.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i12.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }, { type: i7$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
419
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolesComponent, decorators: [{
420
+ type: Component,
421
+ args: [{
422
+ selector: 'fs-acl-roles',
423
+ templateUrl: 'acl-roles.component.html',
424
+ styleUrls: ['acl-roles.component.scss'],
425
+ changeDetection: ChangeDetectionStrategy.OnPush,
426
+ }]
427
+ }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialog }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { deleteAclRole: [{
428
+ type: Input
429
+ }], saveAclRole: [{
430
+ type: Input
431
+ }], loadAclRoles: [{
432
+ type: Input
433
+ }], loadAclRole: [{
434
+ type: Input
435
+ }], aclLevels: [{
436
+ type: Input
437
+ }], list: [{
438
+ type: ViewChildren,
439
+ args: [FsListComponent]
467
440
  }] } });
468
441
 
469
- class FsAclRolePopoverComponent {
470
- constructor(_appAclService) {
471
- this._appAclService = _appAclService;
472
- this.permissions = [];
473
- }
474
- ngOnInit() {
475
- const aclRolePermissions = this.aclRole.permissions || [];
476
- this._appAclService.getPermissions()
477
- .subscribe((response) => {
478
- this.permissions = response.filter(item => {
479
- return aclRolePermissions.some(permission => {
480
- return item.value === permission.value;
481
- });
482
- });
483
- });
484
- }
485
- }
486
- FsAclRolePopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolePopoverComponent, deps: [{ token: FsAppAclService }], target: i0.ɵɵFactoryTarget.Component });
487
- FsAclRolePopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclRolePopoverComponent, selector: "fs-acl-role-popover", inputs: { aclRole: "aclRole", objectName: "objectName" }, ngImport: i0, template: "\n<fs-popover [template]=\"popover\" maxWidth=\"400\">\n <ng-content></ng-content>\n</fs-popover>\n\n<ng-template #popover>\n <div class=\"name small\">{{aclRole.name}}<span *ngIf=\"objectName\">: {{objectName}}</span></div>\n\n <ng-container *ngIf=\"permissions.length; else nonePermission\">\n <div *ngFor=\"let permission of permissions\" class=\"permission\">\n <div>{{permission.name}}</div>\n <div class=\"small\">{{permission.description}}</div>\n </div>\n </ng-container>\n\n <ng-template #nonePermission>\n None\n </ng-template>\n</ng-template>\n", styles: [".name{padding-bottom:10px}.permission+.permission{padding-top:5px}:host{cursor:pointer}\n"], components: [{ type: i2$1.FsPopoverComponent, selector: "fs-popover", inputs: ["template", "data", "leaveDelay", "showDelay", "maxWidth", "wrapperClass", "autoShow", "autoClose", "loadingDiameter", "loading", "indication", "position", "theme", "size", "trigger"] }], directives: [{ type: i7$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
488
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolePopoverComponent, decorators: [{
489
- type: Component,
490
- args: [{
491
- selector: 'fs-acl-role-popover',
492
- templateUrl: './acl-role-popover.component.html',
493
- styleUrls: ['./acl-role-popover.component.scss']
494
- }]
495
- }], ctorParameters: function () { return [{ type: FsAppAclService }]; }, propDecorators: { aclRole: [{
496
- type: Input
497
- }], objectName: [{
498
- type: Input
442
+ class FsAclRolePopoverComponent {
443
+ constructor(_appAclService) {
444
+ this._appAclService = _appAclService;
445
+ this.permissions = [];
446
+ }
447
+ ngOnInit() {
448
+ const aclRolePermissions = this.aclRole.permissions || [];
449
+ this._appAclService.getPermissions()
450
+ .subscribe((response) => {
451
+ this.permissions = response.filter(item => {
452
+ return aclRolePermissions.some(permission => {
453
+ return item.value === permission.value;
454
+ });
455
+ });
456
+ });
457
+ }
458
+ }
459
+ FsAclRolePopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolePopoverComponent, deps: [{ token: FsAppAclService }], target: i0.ɵɵFactoryTarget.Component });
460
+ FsAclRolePopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclRolePopoverComponent, selector: "fs-acl-role-popover", inputs: { aclRole: "aclRole", objectName: "objectName" }, ngImport: i0, template: "\n<fs-popover [template]=\"popover\" maxWidth=\"400\">\n <ng-content></ng-content>\n</fs-popover>\n\n<ng-template #popover>\n <div class=\"name small\">{{aclRole.name}}<span *ngIf=\"objectName\">: {{objectName}}</span></div>\n\n <ng-container *ngIf=\"permissions.length; else nonePermission\">\n <div *ngFor=\"let permission of permissions\" class=\"permission\">\n <div>{{permission.name}}</div>\n <div class=\"small\">{{permission.description}}</div>\n </div>\n </ng-container>\n\n <ng-template #nonePermission>\n None\n </ng-template>\n</ng-template>\n", styles: [".name{padding-bottom:10px}.permission+.permission{padding-top:5px}:host{cursor:pointer}\n"], components: [{ type: i2$1.FsPopoverComponent, selector: "fs-popover", inputs: ["template", "data", "leaveDelay", "showDelay", "maxWidth", "wrapperClass", "autoShow", "autoClose", "loadingDiameter", "loading", "indication", "position", "theme", "size", "trigger"] }], directives: [{ type: i7$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
461
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolePopoverComponent, decorators: [{
462
+ type: Component,
463
+ args: [{
464
+ selector: 'fs-acl-role-popover',
465
+ templateUrl: './acl-role-popover.component.html',
466
+ styleUrls: ['./acl-role-popover.component.scss']
467
+ }]
468
+ }], ctorParameters: function () { return [{ type: FsAppAclService }]; }, propDecorators: { aclRole: [{
469
+ type: Input
470
+ }], objectName: [{
471
+ type: Input
499
472
  }] } });
500
473
 
501
- class FsAclObjectRolesComponent {
502
- constructor() {
503
- this.aclRoles = [];
504
- this.required = false;
505
- this.multiple = false;
506
- this.disabled = false;
507
- this.aclObjectRoles = [];
508
- this.rolesLabel = 'Roles';
509
- this.levelLabel = '';
510
- this.change = new EventEmitter();
511
- this.compareAclRole = (o1, o2) => {
512
- return o1 && o2 && o1.id === o2.id;
513
- };
514
- }
515
- changed() {
516
- this.change.emit(this.aclObjectRoles);
517
- }
518
- }
519
- FsAclObjectRolesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclObjectRolesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
520
- FsAclObjectRolesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclObjectRolesComponent, selector: "fs-acl-object-roles", inputs: { aclRoles: "aclRoles", required: "required", multiple: "multiple", disabled: "disabled", aclObjectRoles: "aclObjectRoles", rolesLabel: "rolesLabel", levelLabel: "levelLabel" }, outputs: { change: "change" }, ngImport: i0, template: "<ng-container *ngIf=\"!multiple\">\n <ng-container *ngFor=\"let aclObjectRole of aclObjectRoles\">\n <fs-checkbox-group\n [(ngModel)]=\"aclObjectRole.aclRoles\"\n (ngModelChange)=\"changed()\"\n name=\"roles\"\n [compareWith]=\"compareAclRole\"\n [disabled]=\"disabled\"\n [label]=\"rolesLabel\"\n [fsFormRequired]=\"required\"\n orientation=\"vertical\">\n <mat-checkbox [disabled]=\"disabled\" *ngFor=\"let aclRole of aclRoles\" [value]=\"aclRole\">\n {{ aclRole.name }}\n </mat-checkbox>\n </fs-checkbox-group>\n </ng-container>\n</ng-container>\n\n<ng-container *ngIf=\"multiple\">\n <table>\n <tr>\n <td>\n <small>{{levelLabel}}</small>\n </td>\n <td>\n <small>{{rolesLabel}}</small>\n </td>\n </tr>\n <tr *ngFor=\"let aclObjectRole of aclObjectRoles\">\n <td>{{aclObjectRole.object.name}}</td>\n <td>\n <mat-form-field class=\"form-field-padless\">\n <mat-select\n [(ngModel)]=\"aclObjectRole.aclRoles\"\n multiple=\"true\"\n [disabled]=\"disabled\"\n [compareWith]=\"compareAclRole\"\n (ngModelChange)=\"changed()\"\n name=\"aclRole_{{ aclObjectRole.object.id }}\">\n <mat-option *ngFor=\"let aclRole of aclRoles\" [value]=\"aclRole\">\n {{ aclRole.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </td>\n </tr>\n </table>\n</ng-container>\n", styles: ["table tr td:first-child{padding-right:15px}\n"], components: [{ type: i1.FsCheckboxGroupComponent, selector: "fs-checkbox-group", inputs: ["orientation", "position", "label", "disabled", "compareWith"], outputs: ["change"] }, { type: i9.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i10.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i11.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i7$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i14.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i15.FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: ["fsFormRequired", "required", "fsFormRequiredMessage"] }], viewProviders: [{ provide: ControlContainer, useExisting: NgForm }] });
521
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclObjectRolesComponent, decorators: [{
522
- type: Component,
523
- args: [{
524
- selector: 'fs-acl-object-roles',
525
- templateUrl: './acl-object-roles.component.html',
526
- styleUrls: ['./acl-object-roles.component.scss'],
527
- viewProviders: [{ provide: ControlContainer, useExisting: NgForm }]
528
- }]
529
- }], propDecorators: { aclRoles: [{
530
- type: Input
531
- }], required: [{
532
- type: Input
533
- }], multiple: [{
534
- type: Input
535
- }], disabled: [{
536
- type: Input
537
- }], aclObjectRoles: [{
538
- type: Input
539
- }], rolesLabel: [{
540
- type: Input
541
- }], levelLabel: [{
542
- type: Input
543
- }], change: [{
544
- type: Output
474
+ class FsAclObjectRolesComponent {
475
+ constructor() {
476
+ this.aclRoles = [];
477
+ this.required = false;
478
+ this.multiple = false;
479
+ this.disabled = false;
480
+ this.aclObjectRoles = [];
481
+ this.rolesLabel = 'Roles';
482
+ this.levelLabel = '';
483
+ this.change = new EventEmitter();
484
+ this.compareAclRole = (o1, o2) => {
485
+ return o1 && o2 && o1.id === o2.id;
486
+ };
487
+ }
488
+ changed() {
489
+ this.change.emit(this.aclObjectRoles);
490
+ }
491
+ }
492
+ FsAclObjectRolesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclObjectRolesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
493
+ FsAclObjectRolesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclObjectRolesComponent, selector: "fs-acl-object-roles", inputs: { aclRoles: "aclRoles", required: "required", multiple: "multiple", disabled: "disabled", aclObjectRoles: "aclObjectRoles", rolesLabel: "rolesLabel", levelLabel: "levelLabel" }, outputs: { change: "change" }, ngImport: i0, template: "<ng-container *ngIf=\"!multiple\">\n <ng-container *ngFor=\"let aclObjectRole of aclObjectRoles\">\n <fs-checkbox-group\n [(ngModel)]=\"aclObjectRole.aclRoles\"\n (ngModelChange)=\"changed()\"\n name=\"roles\"\n [compareWith]=\"compareAclRole\"\n [disabled]=\"disabled\"\n [label]=\"rolesLabel\"\n [fsFormRequired]=\"required\"\n orientation=\"vertical\">\n <mat-checkbox [disabled]=\"disabled\" *ngFor=\"let aclRole of aclRoles\" [value]=\"aclRole\">\n {{ aclRole.name }}\n </mat-checkbox>\n </fs-checkbox-group>\n </ng-container>\n</ng-container>\n\n<ng-container *ngIf=\"multiple\">\n <table>\n <tr>\n <td>\n <small>{{levelLabel}}</small>\n </td>\n <td>\n <small>{{rolesLabel}}</small>\n </td>\n </tr>\n <tr *ngFor=\"let aclObjectRole of aclObjectRoles\">\n <td>{{aclObjectRole.object.name}}</td>\n <td>\n <mat-form-field class=\"form-field-padless\">\n <mat-select\n [(ngModel)]=\"aclObjectRole.aclRoles\"\n multiple=\"true\"\n [disabled]=\"disabled\"\n [compareWith]=\"compareAclRole\"\n (ngModelChange)=\"changed()\"\n name=\"aclRole_{{ aclObjectRole.object.id }}\">\n <mat-option *ngFor=\"let aclRole of aclRoles\" [value]=\"aclRole\">\n {{ aclRole.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </td>\n </tr>\n </table>\n</ng-container>\n", styles: ["table tr td:first-child{padding-right:15px}\n"], components: [{ type: i1.FsCheckboxGroupComponent, selector: "fs-checkbox-group", inputs: ["orientation", "position", "label", "disabled", "compareWith"], outputs: ["change"] }, { type: i9.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i10.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i11.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i7$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i14.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i15.FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: ["fsFormRequired", "required", "fsFormRequiredMessage"] }], viewProviders: [{ provide: ControlContainer, useExisting: NgForm }] });
494
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclObjectRolesComponent, decorators: [{
495
+ type: Component,
496
+ args: [{
497
+ selector: 'fs-acl-object-roles',
498
+ templateUrl: './acl-object-roles.component.html',
499
+ styleUrls: ['./acl-object-roles.component.scss'],
500
+ viewProviders: [{ provide: ControlContainer, useExisting: NgForm }]
501
+ }]
502
+ }], propDecorators: { aclRoles: [{
503
+ type: Input
504
+ }], required: [{
505
+ type: Input
506
+ }], multiple: [{
507
+ type: Input
508
+ }], disabled: [{
509
+ type: Input
510
+ }], aclObjectRoles: [{
511
+ type: Input
512
+ }], rolesLabel: [{
513
+ type: Input
514
+ }], levelLabel: [{
515
+ type: Input
516
+ }], change: [{
517
+ type: Output
545
518
  }] } });
546
519
 
547
- class FsAclEntryComponent {
548
- constructor(_appAclService, _dialogRef, _message, _data) {
549
- var _a;
550
- this._appAclService = _appAclService;
551
- this._dialogRef = _dialogRef;
552
- this._message = _message;
553
- this._data = _data;
554
- this.aclRoles = [];
555
- this.indexedAclRoleLevels = {};
556
- this.titleEdit = 'Edit Roles';
557
- this.titleAdd = 'Assign Roles';
558
- this.required = true;
559
- this.save = () => {
560
- return this._data.saveAclObjectEntry(this._appAclService.output(this.aclObjectEntry))
561
- .subscribe((data) => {
562
- this._message.success('Saved Changes');
563
- this.close(data);
564
- });
565
- };
566
- this.aclObjectEntry = Object.assign({}, _data.aclObjectEntry);
567
- this.required = (_a = _data.required) !== null && _a !== void 0 ? _a : true;
568
- if (_data.titleEdit) {
569
- this.titleEdit = _data.titleEdit;
570
- }
571
- if (_data.titleAdd) {
572
- this.titleAdd = _data.titleAdd;
573
- }
574
- }
575
- ngOnInit() {
576
- forkJoin(this._data.loadAclRoles({
577
- level: this.aclObjectEntry.level,
578
- environmentId: this.aclObjectEntry.environmentId,
579
- })
580
- .pipe(map((data) => this._appAclService.input(data))), this._appAclService.getIndexedLevels())
581
- .subscribe(([aclRoles, levels,]) => {
582
- this.aclRoles = aclRoles;
583
- this.indexedAclRoleLevels = levels;
584
- this.aclObjectRole = {
585
- object: this.aclObjectEntry.object,
586
- aclRoles: this.aclObjectEntry.aclEntries
587
- .map((aclEntry) => {
588
- return aclEntry.aclRole;
589
- })
590
- };
591
- });
592
- }
593
- aclObjectRoleChange(aclObjectRoles) {
594
- this.aclObjectEntry.aclEntries = aclObjectRoles.reduce((aclEntries, aclObjectRole) => {
595
- aclObjectRole.aclRoles.forEach(aclRole => {
596
- aclEntries.push({
597
- aclRoleId: aclRole.id,
598
- aclRole: aclRole,
599
- objectId: aclObjectRole.object ? aclObjectRole.object.id : null,
600
- object: aclObjectRole.object || null
601
- });
602
- });
603
- return aclEntries;
604
- }, []);
605
- }
606
- close(data = null) {
607
- this._dialogRef.close(data);
608
- }
609
- }
610
- FsAclEntryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclEntryComponent, deps: [{ token: FsAppAclService }, { token: i2.MatDialogRef }, { token: i3.FsMessage }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
611
- FsAclEntryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclEntryComponent, selector: "ng-component", ngImport: i0, template: "<form fsForm [submit]=\"save\">\n <fs-dialog>\n <div mat-dialog-title>{{ titleEdit? titleEdit : titleAdd }}</div>\n <mat-dialog-content>\n <div *ngIf=\"aclObjectRole\">\n <fs-label-field *ngIf=\"aclObjectEntry.object\">\n <fs-label>{{indexedAclRoleLevels[aclObjectEntry.level]}}</fs-label>\n {{aclObjectEntry.object.name}}\n </fs-label-field>\n\n <fs-acl-object-roles\n [aclRoles]=\"aclRoles\"\n [aclObjectRoles]=\"[aclObjectRole]\"\n [required]=\"required\"\n (change)=\"aclObjectRoleChange($event)\">\n </fs-acl-object-roles>\n </div>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button type=\"submit\" color=\"primary\">Save</button>\n <button mat-button mat-dialog-close type=\"button\">Cancel</button>\n </mat-dialog-actions>\n </fs-dialog>\n</form>\n", styles: ["::ng-deep .account-roles-autocomplete-panel .mat-option{line-height:normal}::ng-deep .account-roles-autocomplete-panel .mat-option .mat-option-text{display:flex;flex-direction:row;align-items:center}::ng-deep .account-roles-autocomplete-panel .mat-option .mat-option-text fs-badge{margin-right:5px}\n"], components: [{ type: i4.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: i6.FsLabelFieldComponent, selector: "fs-label-field", inputs: ["bottomMargin", "topMargin", "labelMargin"] }, { type: i6.FsLabelComponent, selector: "fs-label" }, { type: FsAclObjectRolesComponent, selector: "fs-acl-object-roles", inputs: ["aclRoles", "required", "multiple", "disabled", "aclObjectRoles", "rolesLabel", "levelLabel"], outputs: ["change"] }, { type: i13.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i14.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i14.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i14.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i15.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"] }, { type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i7$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i15.FsSubmitButtonDirective, selector: "button[type=\"submit\"]", inputs: ["name", "dirtySubmit"] }, { type: i2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }] });
612
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclEntryComponent, decorators: [{
613
- type: Component,
614
- args: [{
615
- templateUrl: './acl-entry.component.html',
616
- styleUrls: ['./acl-entry.component.scss'],
617
- }]
618
- }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialogRef }, { type: i3.FsMessage }, { type: undefined, decorators: [{
619
- type: Inject,
620
- args: [MAT_DIALOG_DATA]
520
+ class FsAclEntryComponent {
521
+ constructor(_appAclService, _dialogRef, _message, _data) {
522
+ var _a;
523
+ this._appAclService = _appAclService;
524
+ this._dialogRef = _dialogRef;
525
+ this._message = _message;
526
+ this._data = _data;
527
+ this.aclRoles = [];
528
+ this.aclEntries = [];
529
+ this.indexedAclRoleLevels = {};
530
+ this.titleEdit = 'Edit Roles';
531
+ this.titleAdd = 'Assign Roles';
532
+ this.required = true;
533
+ this.save = () => {
534
+ const aclObjectEntry = Object.assign(Object.assign({}, this.aclObjectEntry), { aclEntries: this.aclEntries });
535
+ return this._data.saveAclObjectEntry(aclObjectEntry)
536
+ .subscribe((data) => {
537
+ this._message.success('Saved Changes');
538
+ this.close(data);
539
+ });
540
+ };
541
+ this.aclObjectEntry = Object.assign({}, _data.aclObjectEntry);
542
+ this.required = (_a = _data.required) !== null && _a !== void 0 ? _a : true;
543
+ if (_data.titleEdit) {
544
+ this.titleEdit = _data.titleEdit;
545
+ }
546
+ if (_data.titleAdd) {
547
+ this.titleAdd = _data.titleAdd;
548
+ }
549
+ }
550
+ ngOnInit() {
551
+ forkJoin(this._data.loadAclRoles(this.aclObjectEntry), this._appAclService.getIndexedLevels())
552
+ .subscribe(([aclRoles, levels,]) => {
553
+ this.aclRoles = aclRoles;
554
+ this.indexedAclRoleLevels = levels;
555
+ this.aclObjectRole = {
556
+ object: this.aclObjectEntry.object,
557
+ aclRoles: this.aclObjectEntry.aclEntries
558
+ .map((aclEntry) => {
559
+ return aclEntry.aclRole;
560
+ }),
561
+ };
562
+ });
563
+ }
564
+ aclObjectRoleChange(aclObjectRoles) {
565
+ this.aclEntries = aclObjectRoles.reduce((aclEntries, aclObjectRole) => {
566
+ aclObjectRole.aclRoles.forEach(aclRole => {
567
+ aclEntries.push({
568
+ aclRoleId: aclRole.id,
569
+ aclRole: aclRole,
570
+ objectId: aclObjectRole.object ? aclObjectRole.object.id : null,
571
+ object: aclObjectRole.object || null
572
+ });
573
+ });
574
+ return aclEntries;
575
+ }, []);
576
+ }
577
+ close(data = null) {
578
+ this._dialogRef.close(data);
579
+ }
580
+ }
581
+ FsAclEntryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclEntryComponent, deps: [{ token: FsAppAclService }, { token: i2.MatDialogRef }, { token: i3.FsMessage }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
582
+ FsAclEntryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclEntryComponent, selector: "ng-component", ngImport: i0, template: "<form fsForm [submit]=\"save\">\n <fs-dialog>\n <div mat-dialog-title>{{ titleEdit? titleEdit : titleAdd }}</div>\n <mat-dialog-content>\n <div *ngIf=\"aclObjectRole\">\n <fs-label-field *ngIf=\"aclObjectEntry.object\">\n <fs-label>{{indexedAclRoleLevels[aclObjectEntry.level]}}</fs-label>\n {{aclObjectEntry.object.name}}\n </fs-label-field>\n\n <fs-acl-object-roles\n [aclRoles]=\"aclRoles\"\n [aclObjectRoles]=\"[aclObjectRole]\"\n [required]=\"required\"\n (change)=\"aclObjectRoleChange($event)\">\n </fs-acl-object-roles>\n </div>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button type=\"submit\" color=\"primary\">Save</button>\n <button mat-button mat-dialog-close type=\"button\">Cancel</button>\n </mat-dialog-actions>\n </fs-dialog>\n</form>\n", styles: ["::ng-deep .account-roles-autocomplete-panel .mat-option{line-height:normal}::ng-deep .account-roles-autocomplete-panel .mat-option .mat-option-text{display:flex;flex-direction:row;align-items:center}::ng-deep .account-roles-autocomplete-panel .mat-option .mat-option-text fs-badge{margin-right:5px}\n"], components: [{ type: i4.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode"] }, { type: i6.FsLabelFieldComponent, selector: "fs-label-field", inputs: ["bottomMargin", "topMargin", "labelMargin"] }, { type: i6.FsLabelComponent, selector: "fs-label" }, { type: FsAclObjectRolesComponent, selector: "fs-acl-object-roles", inputs: ["aclRoles", "required", "multiple", "disabled", "aclObjectRoles", "rolesLabel", "levelLabel"], outputs: ["change"] }, { type: i13.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i14.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i14.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i14.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i15.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"] }, { type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i7$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i15.FsSubmitButtonDirective, selector: "button[type=\"submit\"]", inputs: ["name", "dirtySubmit"] }, { type: i2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }] });
583
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclEntryComponent, decorators: [{
584
+ type: Component,
585
+ args: [{
586
+ templateUrl: './acl-entry.component.html',
587
+ styleUrls: ['./acl-entry.component.scss'],
588
+ }]
589
+ }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialogRef }, { type: i3.FsMessage }, { type: undefined, decorators: [{
590
+ type: Inject,
591
+ args: [MAT_DIALOG_DATA]
621
592
  }] }]; } });
622
593
 
623
- class FsAclEntriesComponent {
624
- constructor(_appAclService, _dialog, _confirm) {
625
- this._appAclService = _appAclService;
626
- this._dialog = _dialog;
627
- this._confirm = _confirm;
628
- this.environmentShow = true;
629
- this.environmentLabel = 'Environment';
630
- this.actions = [];
631
- this.aclEntriesList = null;
632
- this.aclEntriesConfig = null;
633
- this.permissions = [];
634
- this._destroy$ = new Subject();
635
- }
636
- ngOnInit() {
637
- this._appAclService.getPermissions()
638
- .subscribe(response => {
639
- this.permissions = response;
640
- });
641
- this.aclEntriesConfig = {
642
- status: false,
643
- paging: false,
644
- actions: this.actions,
645
- rowActions: [
646
- {
647
- label: 'Remove All Roles',
648
- click: (aclObjectEntry) => {
649
- this._confirm
650
- .confirm({
651
- title: 'Remove All Roles',
652
- template: 'Are you sure you would like to remove all roles?',
653
- }).subscribe(() => {
654
- const data = this._appAclService.output(Object.assign(Object.assign({}, aclObjectEntry), { aclEntries: [] }));
655
- this.saveAclObjectEntry(data)
656
- .subscribe(() => {
657
- this.aclEntriesList.reload();
658
- });
659
- });
660
- }
661
- }
662
- ],
663
- fetch: () => {
664
- return new Observable((observer) => {
665
- this.loadAclEntries({
666
- aclRoles: true,
667
- aclRolePermissions: true,
668
- objects: true,
669
- aclRoleState: 'active',
670
- })
671
- .pipe(map((response) => this._appAclService.input(response)))
672
- .subscribe((aclEntries) => {
673
- const objects = aclEntries.reduce((items, item) => {
674
- if (item.object) {
675
- items[item.object.id] = item.object;
676
- }
677
- return items;
678
- }, {});
679
- const environments = aclEntries.reduce((items, item) => {
680
- if (item.environment) {
681
- items[item.environment.id] = item.environment;
682
- }
683
- return items;
684
- }, {});
685
- let aclObjectEntry = [];
686
- const grouped = groupBy(aclEntries, (item) => {
687
- return [item.aclRole.level, item.environmentId, item.objectId];
688
- });
689
- forOwn(grouped, (group, key) => {
690
- key = key.split(',');
691
- aclObjectEntry.push({
692
- object: objects[key[2]],
693
- level: key[0],
694
- environmentId: key[1] ? parseInt(key[1]) : null,
695
- environment: environments[key[1]],
696
- aclEntries: group,
697
- });
698
- });
699
- const hasApp = aclObjectEntry.some((item) => {
700
- return item.aclEntries.some((entry) => {
701
- return !entry.objectId;
702
- });
703
- });
704
- if (!hasApp) {
705
- aclObjectEntry.unshift({
706
- object: null, aclEntries: [],
707
- level: 'app',
708
- environmentId: null,
709
- });
710
- }
711
- aclObjectEntry = sortBy(aclObjectEntry, (item) => {
712
- return item.object ? item.level : '';
713
- });
714
- observer.next({ data: aclObjectEntry });
715
- observer.complete();
716
- });
717
- });
718
- },
719
- };
720
- }
721
- update(aclObjectEntry) {
722
- const data = {
723
- aclObjectEntry: aclObjectEntry,
724
- required: false,
725
- loadAclRoles: this.loadAclRoles,
726
- saveAclObjectEntry: this.saveAclObjectEntry
727
- };
728
- this._dialog.open(FsAclEntryComponent, {
729
- data: data
730
- })
731
- .afterClosed()
732
- .pipe(takeUntil(this._destroy$))
733
- .subscribe(() => {
734
- this.aclEntriesList.reload();
735
- });
736
- }
737
- ngOnDestroy() {
738
- this._destroy$.next();
739
- this._destroy$.complete();
740
- }
741
- reload() {
742
- this.aclEntriesList.reload();
743
- }
744
- }
745
- 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 });
746
- 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 *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]" }] });
747
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclEntriesComponent, decorators: [{
748
- type: Component,
749
- args: [{
750
- selector: 'fs-acl-entries',
751
- templateUrl: './acl-entries.component.html',
752
- styleUrls: ['./acl-entries.component.scss']
753
- }]
754
- }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialog }, { type: i3$1.FsPrompt }]; }, propDecorators: { loadAclEntries: [{
755
- type: Input
756
- }], loadAclRoles: [{
757
- type: Input
758
- }], saveAclObjectEntry: [{
759
- type: Input
760
- }], environmentShow: [{
761
- type: Input
762
- }], environmentLabel: [{
763
- type: Input
764
- }], actions: [{
765
- type: Input
766
- }], aclEntriesList: [{
767
- type: ViewChild,
768
- args: [FsListComponent]
594
+ class FsAclEntriesComponent {
595
+ constructor(_appAclService, _dialog, _confirm) {
596
+ this._appAclService = _appAclService;
597
+ this._dialog = _dialog;
598
+ this._confirm = _confirm;
599
+ this.environmentShow = true;
600
+ this.environmentLabel = 'Environment';
601
+ this.environmentKey = 'environment';
602
+ this.actions = [];
603
+ this.aclEntriesList = null;
604
+ this.aclEntriesConfig = null;
605
+ this.permissions = [];
606
+ this._destroy$ = new Subject();
607
+ }
608
+ ngOnInit() {
609
+ this._appAclService.getPermissions()
610
+ .subscribe(response => {
611
+ this.permissions = response;
612
+ });
613
+ this.aclEntriesConfig = {
614
+ status: false,
615
+ paging: false,
616
+ actions: this.actions,
617
+ rowActions: [
618
+ {
619
+ label: 'Remove All Roles',
620
+ click: (aclObjectEntry) => {
621
+ this._confirm
622
+ .confirm({
623
+ title: 'Remove All Roles',
624
+ template: 'Are you sure you would like to remove all roles?',
625
+ }).subscribe(() => {
626
+ const data = Object.assign(Object.assign({}, aclObjectEntry), { aclEntries: [] });
627
+ this.saveAclObjectEntry(data)
628
+ .subscribe(() => {
629
+ this.aclEntriesList.reload();
630
+ });
631
+ });
632
+ }
633
+ }
634
+ ],
635
+ fetch: () => {
636
+ return new Observable((observer) => {
637
+ this.loadAclEntries({
638
+ aclRoles: true,
639
+ aclRolePermissions: true,
640
+ objects: true,
641
+ aclRoleState: 'active',
642
+ })
643
+ .subscribe((aclEntries) => {
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 });
648
+ }, {});
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 });
654
+ }, {});
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];
659
+ });
660
+ let aclObjectEntries = Object.keys(groupedAclEntries)
661
+ .reduce((accum, key) => {
662
+ key = key.split(',');
663
+ return [
664
+ ...accum,
665
+ {
666
+ object: objects[key[2]],
667
+ level: key[0],
668
+ [`${this.environmentKey}Id`]: key[1] ? parseInt(key[1]) : null,
669
+ [this.environmentKey]: environments[key[1]],
670
+ aclEntries,
671
+ }
672
+ ];
673
+ }, []);
674
+ const hasApp = aclObjectEntries.some((item) => {
675
+ return item.aclEntries.some((entry) => {
676
+ return !entry.objectId;
677
+ });
678
+ });
679
+ if (!hasApp) {
680
+ aclObjectEntries.unshift({
681
+ object: null,
682
+ aclEntries: [],
683
+ level: 'app',
684
+ environmentId: null,
685
+ });
686
+ }
687
+ aclObjectEntries = sortBy(aclObjectEntries, (item) => {
688
+ return item.object ? item.level : '';
689
+ });
690
+ observer.next({ data: aclObjectEntries });
691
+ observer.complete();
692
+ });
693
+ });
694
+ },
695
+ };
696
+ }
697
+ update(aclObjectEntry) {
698
+ const data = {
699
+ aclObjectEntry,
700
+ required: false,
701
+ loadAclRoles: this.loadAclRoles,
702
+ saveAclObjectEntry: this.saveAclObjectEntry
703
+ };
704
+ this._dialog.open(FsAclEntryComponent, {
705
+ data: data
706
+ })
707
+ .afterClosed()
708
+ .pipe(takeUntil(this._destroy$))
709
+ .subscribe(() => {
710
+ this.aclEntriesList.reload();
711
+ });
712
+ }
713
+ ngOnDestroy() {
714
+ this._destroy$.next();
715
+ this._destroy$.complete();
716
+ }
717
+ reload() {
718
+ this.aclEntriesList.reload();
719
+ }
720
+ }
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 });
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]" }] });
723
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclEntriesComponent, decorators: [{
724
+ type: Component,
725
+ args: [{
726
+ selector: 'fs-acl-entries',
727
+ templateUrl: './acl-entries.component.html',
728
+ styleUrls: ['./acl-entries.component.scss']
729
+ }]
730
+ }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialog }, { type: i3$1.FsPrompt }]; }, propDecorators: { loadAclEntries: [{
731
+ type: Input
732
+ }], loadAclRoles: [{
733
+ type: Input
734
+ }], saveAclObjectEntry: [{
735
+ type: Input
736
+ }], environmentShow: [{
737
+ type: Input
738
+ }], environmentLabel: [{
739
+ type: Input
740
+ }], environmentKey: [{
741
+ type: Input
742
+ }], actions: [{
743
+ type: Input
744
+ }], aclEntriesList: [{
745
+ type: ViewChild,
746
+ args: [FsListComponent]
769
747
  }] } });
770
748
 
771
- class FsAppAclModule {
772
- }
773
- FsAppAclModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
774
- FsAppAclModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, declarations: [FsAclRolesComponent,
775
- FsAclPermissionPopoverComponent,
776
- FsAclRoleComponent,
777
- FsAclEntriesComponent,
778
- FsAclRolePopoverComponent,
779
- FsAclObjectRolesComponent,
780
- FsAclEntryComponent], imports: [CommonModule,
781
- FormsModule,
782
- MatDialogModule,
783
- MatFormFieldModule,
784
- MatCheckboxModule,
785
- MatSelectModule,
786
- MatButtonModule,
787
- MatRadioModule,
788
- MatInputModule,
789
- FlexLayoutModule,
790
- FsListModule,
791
- FsPopoverModule,
792
- FsDialogModule,
793
- FsFormModule,
794
- FsLabelModule,
795
- FsRadioGroupModule,
796
- FsBadgeModule,
797
- FsCheckboxGroupModule], exports: [FsAclRolesComponent,
798
- FsAclPermissionPopoverComponent,
799
- FsAclRoleComponent,
800
- FsAclEntriesComponent,
801
- FsAclRolePopoverComponent,
802
- FsAclObjectRolesComponent,
803
- FsAclEntryComponent] });
804
- FsAppAclModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, imports: [[
805
- CommonModule,
806
- FormsModule,
807
- MatDialogModule,
808
- MatFormFieldModule,
809
- MatCheckboxModule,
810
- MatSelectModule,
811
- MatButtonModule,
812
- MatRadioModule,
813
- MatInputModule,
814
- FlexLayoutModule,
815
- FsListModule,
816
- FsPopoverModule,
817
- FsDialogModule,
818
- FsFormModule,
819
- FsLabelModule,
820
- FsRadioGroupModule,
821
- FsBadgeModule,
822
- FsCheckboxGroupModule,
823
- ]] });
824
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, decorators: [{
825
- type: NgModule,
826
- args: [{
827
- imports: [
828
- CommonModule,
829
- FormsModule,
830
- MatDialogModule,
831
- MatFormFieldModule,
832
- MatCheckboxModule,
833
- MatSelectModule,
834
- MatButtonModule,
835
- MatRadioModule,
836
- MatInputModule,
837
- FlexLayoutModule,
838
- FsListModule,
839
- FsPopoverModule,
840
- FsDialogModule,
841
- FsFormModule,
842
- FsLabelModule,
843
- FsRadioGroupModule,
844
- FsBadgeModule,
845
- FsCheckboxGroupModule,
846
- ],
847
- declarations: [
848
- FsAclRolesComponent,
849
- FsAclPermissionPopoverComponent,
850
- FsAclRoleComponent,
851
- FsAclEntriesComponent,
852
- FsAclRolePopoverComponent,
853
- FsAclObjectRolesComponent,
854
- FsAclEntryComponent,
855
- ],
856
- exports: [
857
- FsAclRolesComponent,
858
- FsAclPermissionPopoverComponent,
859
- FsAclRoleComponent,
860
- FsAclEntriesComponent,
861
- FsAclRolePopoverComponent,
862
- FsAclObjectRolesComponent,
863
- FsAclEntryComponent,
864
- ],
865
- }]
749
+ class FsAppAclModule {
750
+ }
751
+ FsAppAclModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
752
+ FsAppAclModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, declarations: [FsAclRolesComponent,
753
+ FsAclPermissionPopoverComponent,
754
+ FsAclRoleComponent,
755
+ FsAclEntriesComponent,
756
+ FsAclRolePopoverComponent,
757
+ FsAclObjectRolesComponent,
758
+ FsAclEntryComponent], imports: [CommonModule,
759
+ FormsModule,
760
+ MatDialogModule,
761
+ MatFormFieldModule,
762
+ MatCheckboxModule,
763
+ MatSelectModule,
764
+ MatButtonModule,
765
+ MatRadioModule,
766
+ MatInputModule,
767
+ FlexLayoutModule,
768
+ FsListModule,
769
+ FsPopoverModule,
770
+ FsDialogModule,
771
+ FsFormModule,
772
+ FsLabelModule,
773
+ FsRadioGroupModule,
774
+ FsBadgeModule,
775
+ FsCheckboxGroupModule], exports: [FsAclRolesComponent,
776
+ FsAclPermissionPopoverComponent,
777
+ FsAclRoleComponent,
778
+ FsAclEntriesComponent,
779
+ FsAclRolePopoverComponent,
780
+ FsAclObjectRolesComponent,
781
+ FsAclEntryComponent] });
782
+ FsAppAclModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, imports: [[
783
+ CommonModule,
784
+ FormsModule,
785
+ MatDialogModule,
786
+ MatFormFieldModule,
787
+ MatCheckboxModule,
788
+ MatSelectModule,
789
+ MatButtonModule,
790
+ MatRadioModule,
791
+ MatInputModule,
792
+ FlexLayoutModule,
793
+ FsListModule,
794
+ FsPopoverModule,
795
+ FsDialogModule,
796
+ FsFormModule,
797
+ FsLabelModule,
798
+ FsRadioGroupModule,
799
+ FsBadgeModule,
800
+ FsCheckboxGroupModule,
801
+ ]] });
802
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, decorators: [{
803
+ type: NgModule,
804
+ args: [{
805
+ imports: [
806
+ CommonModule,
807
+ FormsModule,
808
+ MatDialogModule,
809
+ MatFormFieldModule,
810
+ MatCheckboxModule,
811
+ MatSelectModule,
812
+ MatButtonModule,
813
+ MatRadioModule,
814
+ MatInputModule,
815
+ FlexLayoutModule,
816
+ FsListModule,
817
+ FsPopoverModule,
818
+ FsDialogModule,
819
+ FsFormModule,
820
+ FsLabelModule,
821
+ FsRadioGroupModule,
822
+ FsBadgeModule,
823
+ FsCheckboxGroupModule,
824
+ ],
825
+ declarations: [
826
+ FsAclRolesComponent,
827
+ FsAclPermissionPopoverComponent,
828
+ FsAclRoleComponent,
829
+ FsAclEntriesComponent,
830
+ FsAclRolePopoverComponent,
831
+ FsAclObjectRolesComponent,
832
+ FsAclEntryComponent,
833
+ ],
834
+ exports: [
835
+ FsAclRolesComponent,
836
+ FsAclPermissionPopoverComponent,
837
+ FsAclRoleComponent,
838
+ FsAclEntriesComponent,
839
+ FsAclRolePopoverComponent,
840
+ FsAclObjectRolesComponent,
841
+ FsAclEntryComponent,
842
+ ],
843
+ }]
866
844
  }] });
867
845
 
868
- /**
869
- * Generated bundle index. Do not edit.
846
+ /**
847
+ * Generated bundle index. Do not edit.
870
848
  */
871
849
 
872
850
  export { FS_APP_ACL_CONFIG, FsAclEntriesComponent, FsAclEntryComponent, FsAclObjectRolesComponent, FsAclPermissionPopoverComponent, FsAclRoleComponent, FsAclRolePopoverComponent, FsAclRolesComponent, FsAppAclModule, FsAppAclService };