@firestitch/app-acl 12.4.0 → 12.4.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 (59) hide show
  1. package/app/components/acl-entries/acl-entries.component.d.ts +33 -33
  2. package/app/components/acl-entry/acl-entry.component.d.ts +31 -31
  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 +48 -48
  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 +37 -36
  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-config.d.ts +5 -5
  20. package/app/interfaces/acl-role.d.ts +16 -16
  21. package/app/interfaces/app-acl-config.d.ts +7 -7
  22. package/app/interfaces/index.d.ts +2 -2
  23. package/app/interfaces/name-value.d.ts +4 -4
  24. package/app/interfaces/role-config.d.ts +12 -11
  25. package/app/services/app-acl.service.d.ts +16 -16
  26. package/bundles/firestitch-app-acl.umd.js +1163 -1144
  27. package/bundles/firestitch-app-acl.umd.js.map +1 -1
  28. package/esm2015/app/components/acl-entries/acl-entries.component.js +176 -173
  29. package/esm2015/app/components/acl-entry/acl-entry.component.js +94 -90
  30. package/esm2015/app/components/acl-object-roles/acl-object-roles.component.js +57 -57
  31. package/esm2015/app/components/acl-permission-popover/acl-permission-popover.component.js +33 -33
  32. package/esm2015/app/components/acl-role/acl-role.component.js +208 -208
  33. package/esm2015/app/components/acl-role-popover/acl-role-popover.component.js +38 -38
  34. package/esm2015/app/components/acl-roles/acl-roles.component.js +163 -148
  35. package/esm2015/app/consts/acl-role-accesses.js +7 -7
  36. package/esm2015/app/enums/acl-role-access.js +7 -7
  37. package/esm2015/app/fs-app-acl.module.js +123 -123
  38. package/esm2015/app/injectors/app-acl-config.injector.js +2 -2
  39. package/esm2015/app/interfaces/acl-entry-data.js +1 -1
  40. package/esm2015/app/interfaces/acl-entry.js +1 -1
  41. package/esm2015/app/interfaces/acl-level.js +1 -1
  42. package/esm2015/app/interfaces/acl-object-entry.js +1 -1
  43. package/esm2015/app/interfaces/acl-object-role.js +1 -1
  44. package/esm2015/app/interfaces/acl-object.js +1 -1
  45. package/esm2015/app/interfaces/acl-permission.js +1 -1
  46. package/esm2015/app/interfaces/acl-role-config.js +1 -1
  47. package/esm2015/app/interfaces/acl-role.js +1 -1
  48. package/esm2015/app/interfaces/app-acl-config.js +1 -1
  49. package/esm2015/app/interfaces/index.js +2 -2
  50. package/esm2015/app/interfaces/name-value.js +1 -1
  51. package/esm2015/app/interfaces/role-config.js +2 -2
  52. package/esm2015/app/services/app-acl.service.js +50 -50
  53. package/esm2015/firestitch-app-acl.js +4 -4
  54. package/esm2015/public_api.js +10 -10
  55. package/fesm2015/firestitch-app-acl.js +807 -786
  56. package/fesm2015/firestitch-app-acl.js.map +1 -1
  57. package/firestitch-app-acl.d.ts +5 -5
  58. package/package.json +1 -1
  59. package/public_api.d.ts +20 -20
@@ -45,816 +45,837 @@ import * as i17 from '@angular/flex-layout/flex';
45
45
  import { groupBy, sortBy } from 'lodash-es';
46
46
  import * as i3$1 from '@firestitch/prompt';
47
47
 
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";
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";
54
54
  })(AclRoleAccess || (AclRoleAccess = {}));
55
55
 
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 }
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 }
61
61
  ];
62
62
 
63
63
  const FS_APP_ACL_CONFIG = new InjectionToken('fs-app-acl-config');
64
64
 
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]
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]
108
108
  }] }]; } });
109
109
 
110
- class FsAclRoleComponent {
111
- constructor(_data, _appAclService, _dialogRef, _message, _cdRef) {
112
- this._data = _data;
113
- this._appAclService = _appAclService;
114
- this._dialogRef = _dialogRef;
115
- this._message = _message;
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.roleConfigs = [];
127
- this.aclRoleConfigValues = {};
128
- this._destroy$ = new Subject();
129
- this.save = () => {
130
- const aclRoleConfigs = this.roleConfigs
131
- .map((roleConfig) => {
132
- return {
133
- name: roleConfig.name,
134
- value: this.aclRoleConfigValues[roleConfig.name],
135
- };
136
- });
137
- const aclRole = Object.assign(Object.assign({}, this.aclRole), { permissions: this.levelPermissions.map((permission) => {
138
- return {
139
- value: permission.value,
140
- access: this.aclRole.permissions[permission.value] || 0,
141
- };
142
- }), aclRoleConfigs });
143
- return this._data.saveAclRole(aclRole)
144
- .pipe(tap((response) => {
145
- this._message.success('Saved Changes');
146
- this.close(response);
147
- }));
148
- };
149
- }
150
- ngOnInit() {
151
- forkJoin(this.getRole(), this._appAclService.getPermissions())
152
- .pipe(takeUntil(this._destroy$))
153
- .subscribe(([aclRole, aclPermissions,]) => {
154
- this.permissions = aclPermissions;
155
- this.aclLevels = this._data.aclLevels;
156
- this.indexedAclLevels = list(this.aclLevels, 'name', 'value');
157
- this.indexedAccesses = list(AclRoleAccesses, 'name', 'value');
158
- this.aclRole = Object.assign({
159
- aclPermissions: [],
160
- allPermissions: true,
161
- aclRoleConfigs: [],
162
- permissions: {},
163
- level: this.aclLevels[0].value,
164
- }, aclRole);
165
- this.aclRoleConfigValues = (aclRole.aclRoleConfigs || [])
166
- .reduce((accum, aclRoleConfig) => {
167
- return Object.assign(Object.assign({}, accum), { [aclRoleConfig.name]: aclRoleConfig.value });
168
- }, {});
169
- if (this.aclRole.id) {
170
- this.permissions.forEach((permission) => {
171
- let access = 0;
172
- const aclPermission = this.aclRole.aclPermissions.find((item) => {
173
- return item.permission === permission.value;
174
- });
175
- if (aclPermission) {
176
- access = aclPermission.access;
177
- }
178
- this.aclRole.permissions[permission.value] = access;
179
- });
180
- }
181
- if (this.aclRole.allPermissions) {
182
- this._applyMaxPermissionAccess();
183
- }
184
- this._updatePermissions();
185
- this._updateRoleConfigs();
186
- this._cdRef.markForCheck();
187
- });
188
- this.listConfig = {
189
- status: false,
190
- paging: false,
191
- noResults: {
192
- message: '',
193
- },
194
- group: {
195
- initialExpand: true,
196
- groupBy: (data) => {
197
- return data;
198
- },
199
- compareBy: (data) => {
200
- return data.category || 'General';
201
- },
202
- },
203
- fetch: () => {
204
- return of({
205
- data: this.levelPermissions.sort((a, b) => {
206
- a = a.name.toUpperCase();
207
- b = b.name.toUpperCase();
208
- if (a < b) {
209
- return -1;
210
- }
211
- else if (a > b) {
212
- return 1;
213
- }
214
- return 0;
215
- }),
216
- });
217
- },
218
- };
219
- }
220
- levelChange() {
221
- this._updatePermissions();
222
- this._updateRoleConfigs();
223
- this.list.reload();
224
- }
225
- getRole() {
226
- if (!this._data.aclRole.id) {
227
- return of(this._data.aclRole);
228
- }
229
- const query = {
230
- aclPermissions: true,
231
- aclRoleConfigs: true,
232
- };
233
- if (!this.environment) {
234
- query.environmentId = null;
235
- }
236
- return this._data.loadAclRole(this._data.aclRole, query);
237
- }
238
- close(data = null) {
239
- this._dialogRef.close(data);
240
- }
241
- allPermissionsChange(all) {
242
- this._updatePermissions();
243
- if (all) {
244
- this._applyMaxPermissionAccess();
245
- }
246
- }
247
- ngOnDestroy() {
248
- this._destroy$.next();
249
- this._destroy$.complete();
250
- }
251
- _updatePermissions() {
252
- this.levelPermissions = this.permissions.filter((permission) => {
253
- return permission.levels.some((item) => {
254
- return item === this.aclRole.level;
255
- });
256
- });
257
- }
258
- _updateRoleConfigs() {
259
- if (this._data.loadRoleConfigs) {
260
- this._data.loadRoleConfigs()
261
- .subscribe((roleConfigs) => {
262
- this.roleConfigs = roleConfigs
263
- .filter((roleConfig) => roleConfig.level === this.aclRole.level);
264
- this._cdRef.markForCheck();
265
- });
266
- }
267
- }
268
- _applyMaxPermissionAccess() {
269
- this.permissions.forEach((permission) => {
270
- this.aclRole.permissions[permission.value] = Math.max(...permission.accesses);
271
- });
272
- }
273
- }
274
- FsAclRoleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRoleComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: FsAppAclService }, { token: i2.MatDialogRef }, { token: i3.FsMessage }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
275
- 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 \n matInput \n placeholder=\"Name\" \n [(ngModel)]=\"aclRole.name\" \n name=\"name\" \n fsFormRequired>\n </mat-form-field>\n\n <mat-form-field>\n <input \n matInput \n placeholder=\"Description\" \n [(ngModel)]=\"aclRole.description\"\n name=\"description\">\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 Enable\n </mat-checkbox>\n </fs-label-field>\n\n <div fxLayout=\"column\" *ngFor=\"let roleConfig of roleConfigs\">\n <fs-label-field *ngIf=\"roleConfig.type === 'checkbox'\">\n <fs-label>{{roleConfig.label}}</fs-label>\n <mat-checkbox\n [(ngModel)]=\"aclRoleConfigValues[roleConfig.name]\"\n [name]=\"roleConfig.name\">\n Enable\n </mat-checkbox>\n <fs-label-message>\n <mat-hint>{{roleConfig.description}}</mat-hint>\n </fs-label-message>\n </fs-label-field>\n\n <mat-form-field *ngIf=\"roleConfig.type === 'select'\">\n <mat-select\n [(ngModel)]=\"aclRoleConfigValues[roleConfig.name]\"\n [name]=\"roleConfig.name\"\n [required]=\"roleConfig.required\"\n [placeholder]=\"roleConfig.label\">\n <mat-option\n *ngFor=\"let item of roleConfig.values\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n <mat-hint>{{roleConfig.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 });
276
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRoleComponent, decorators: [{
277
- type: Component,
278
- args: [{
279
- templateUrl: './acl-role.component.html',
280
- styleUrls: ['./acl-role.component.scss'],
281
- changeDetection: ChangeDetectionStrategy.OnPush,
282
- }]
283
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
284
- type: Inject,
285
- args: [MAT_DIALOG_DATA]
286
- }] }, { type: FsAppAclService }, { type: i2.MatDialogRef }, { type: i3.FsMessage }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { list: [{
287
- type: ViewChild,
288
- args: [FsListComponent]
110
+ class FsAclRoleComponent {
111
+ constructor(_data, _appAclService, _dialogRef, _message, _cdRef) {
112
+ this._data = _data;
113
+ this._appAclService = _appAclService;
114
+ this._dialogRef = _dialogRef;
115
+ this._message = _message;
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.roleConfigs = [];
127
+ this.aclRoleConfigValues = {};
128
+ this._destroy$ = new Subject();
129
+ this.save = () => {
130
+ const aclRoleConfigs = this.roleConfigs
131
+ .map((roleConfig) => {
132
+ return {
133
+ name: roleConfig.name,
134
+ value: this.aclRoleConfigValues[roleConfig.name],
135
+ };
136
+ });
137
+ const aclRole = Object.assign(Object.assign({}, this.aclRole), { permissions: this.levelPermissions.map((permission) => {
138
+ return {
139
+ value: permission.value,
140
+ access: this.aclRole.permissions[permission.value] || 0,
141
+ };
142
+ }), aclRoleConfigs });
143
+ return this._data.saveAclRole(aclRole)
144
+ .pipe(tap((response) => {
145
+ this._message.success('Saved Changes');
146
+ this.close(response);
147
+ }));
148
+ };
149
+ }
150
+ ngOnInit() {
151
+ forkJoin(this.getRole(), this._appAclService.getPermissions())
152
+ .pipe(takeUntil(this._destroy$))
153
+ .subscribe(([aclRole, aclPermissions,]) => {
154
+ this.permissions = aclPermissions;
155
+ this.aclLevels = this._data.aclLevels;
156
+ this.indexedAclLevels = list(this.aclLevels, 'name', 'value');
157
+ this.indexedAccesses = list(AclRoleAccesses, 'name', 'value');
158
+ this.aclRole = Object.assign({
159
+ aclPermissions: [],
160
+ allPermissions: true,
161
+ aclRoleConfigs: [],
162
+ permissions: {},
163
+ level: this.aclLevels[0].value,
164
+ }, aclRole);
165
+ this.aclRoleConfigValues = (aclRole.aclRoleConfigs || [])
166
+ .reduce((accum, aclRoleConfig) => {
167
+ return Object.assign(Object.assign({}, accum), { [aclRoleConfig.name]: aclRoleConfig.value });
168
+ }, {});
169
+ if (this.aclRole.id) {
170
+ this.permissions.forEach((permission) => {
171
+ let access = 0;
172
+ const aclPermission = this.aclRole.aclPermissions.find((item) => {
173
+ return item.permission === permission.value;
174
+ });
175
+ if (aclPermission) {
176
+ access = aclPermission.access;
177
+ }
178
+ this.aclRole.permissions[permission.value] = access;
179
+ });
180
+ }
181
+ if (this.aclRole.allPermissions) {
182
+ this._applyMaxPermissionAccess();
183
+ }
184
+ this._updatePermissions();
185
+ this._updateRoleConfigs();
186
+ this._cdRef.markForCheck();
187
+ });
188
+ this.listConfig = {
189
+ status: false,
190
+ paging: false,
191
+ noResults: {
192
+ message: '',
193
+ },
194
+ group: {
195
+ initialExpand: true,
196
+ groupBy: (data) => {
197
+ return data;
198
+ },
199
+ compareBy: (data) => {
200
+ return data.category || 'General';
201
+ },
202
+ },
203
+ fetch: () => {
204
+ return of({
205
+ data: this.levelPermissions.sort((a, b) => {
206
+ a = a.name.toUpperCase();
207
+ b = b.name.toUpperCase();
208
+ if (a < b) {
209
+ return -1;
210
+ }
211
+ else if (a > b) {
212
+ return 1;
213
+ }
214
+ return 0;
215
+ }),
216
+ });
217
+ },
218
+ };
219
+ }
220
+ levelChange() {
221
+ this._updatePermissions();
222
+ this._updateRoleConfigs();
223
+ this.list.reload();
224
+ }
225
+ getRole() {
226
+ if (!this._data.aclRole.id) {
227
+ return of(this._data.aclRole);
228
+ }
229
+ const query = {
230
+ aclPermissions: true,
231
+ aclRoleConfigs: true,
232
+ };
233
+ if (!this.environment) {
234
+ query.environmentId = null;
235
+ }
236
+ return this._data.loadAclRole(this._data.aclRole, query);
237
+ }
238
+ close(data = null) {
239
+ this._dialogRef.close(data);
240
+ }
241
+ allPermissionsChange(all) {
242
+ this._updatePermissions();
243
+ if (all) {
244
+ this._applyMaxPermissionAccess();
245
+ }
246
+ }
247
+ ngOnDestroy() {
248
+ this._destroy$.next();
249
+ this._destroy$.complete();
250
+ }
251
+ _updatePermissions() {
252
+ this.levelPermissions = this.permissions.filter((permission) => {
253
+ return permission.levels.some((item) => {
254
+ return item === this.aclRole.level;
255
+ });
256
+ });
257
+ }
258
+ _updateRoleConfigs() {
259
+ if (this._data.loadRoleConfigs) {
260
+ this._data.loadRoleConfigs()
261
+ .subscribe((roleConfigs) => {
262
+ this.roleConfigs = roleConfigs
263
+ .filter((roleConfig) => roleConfig.level === this.aclRole.level);
264
+ this._cdRef.markForCheck();
265
+ });
266
+ }
267
+ }
268
+ _applyMaxPermissionAccess() {
269
+ this.permissions.forEach((permission) => {
270
+ this.aclRole.permissions[permission.value] = Math.max(...permission.accesses);
271
+ });
272
+ }
273
+ }
274
+ FsAclRoleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRoleComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: FsAppAclService }, { token: i2.MatDialogRef }, { token: i3.FsMessage }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
275
+ 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 \n matInput \n placeholder=\"Name\" \n [(ngModel)]=\"aclRole.name\" \n name=\"name\" \n fsFormRequired>\n </mat-form-field>\n\n <mat-form-field>\n <input \n matInput \n placeholder=\"Description\" \n [(ngModel)]=\"aclRole.description\"\n name=\"description\">\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 Enable\n </mat-checkbox>\n </fs-label-field>\n\n <div fxLayout=\"column\" *ngFor=\"let roleConfig of roleConfigs\">\n <fs-label-field *ngIf=\"roleConfig.type === 'checkbox'\">\n <fs-label>{{roleConfig.label}}</fs-label>\n <mat-checkbox\n [(ngModel)]=\"aclRoleConfigValues[roleConfig.name]\"\n [name]=\"roleConfig.name\">\n Enable\n </mat-checkbox>\n <fs-label-message>\n <mat-hint>{{roleConfig.description}}</mat-hint>\n </fs-label-message>\n </fs-label-field>\n\n <mat-form-field *ngIf=\"roleConfig.type === 'select'\">\n <mat-select\n [(ngModel)]=\"aclRoleConfigValues[roleConfig.name]\"\n [name]=\"roleConfig.name\"\n [required]=\"roleConfig.required\"\n [placeholder]=\"roleConfig.label\">\n <mat-option\n *ngFor=\"let item of roleConfig.values\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n <mat-hint>{{roleConfig.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 });
276
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRoleComponent, decorators: [{
277
+ type: Component,
278
+ args: [{
279
+ templateUrl: './acl-role.component.html',
280
+ styleUrls: ['./acl-role.component.scss'],
281
+ changeDetection: ChangeDetectionStrategy.OnPush,
282
+ }]
283
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
284
+ type: Inject,
285
+ args: [MAT_DIALOG_DATA]
286
+ }] }, { type: FsAppAclService }, { type: i2.MatDialogRef }, { type: i3.FsMessage }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { list: [{
287
+ type: ViewChild,
288
+ args: [FsListComponent]
289
289
  }] } });
290
290
 
291
- class FsAclPermissionPopoverComponent {
292
- constructor(_appAclService) {
293
- this._appAclService = _appAclService;
294
- }
295
- ngOnInit() {
296
- this._appAclService.getPermissions()
297
- .subscribe(permissions => {
298
- this.description = permissions.filter(item => {
299
- return item.value === this.permission.value;
300
- }).map(item => {
301
- return item.description;
302
- })[0];
303
- });
304
- }
305
- }
306
- FsAclPermissionPopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclPermissionPopoverComponent, deps: [{ token: FsAppAclService }], target: i0.ɵɵFactoryTarget.Component });
307
- 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"] }] });
308
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclPermissionPopoverComponent, decorators: [{
309
- type: Component,
310
- args: [{
311
- selector: 'acl-permission-popover',
312
- templateUrl: './acl-permission-popover.component.html',
313
- styleUrls: ['./acl-permission-popover.component.scss']
314
- }]
315
- }], ctorParameters: function () { return [{ type: FsAppAclService }]; }, propDecorators: { permission: [{
316
- type: Input
291
+ class FsAclPermissionPopoverComponent {
292
+ constructor(_appAclService) {
293
+ this._appAclService = _appAclService;
294
+ }
295
+ ngOnInit() {
296
+ this._appAclService.getPermissions()
297
+ .subscribe(permissions => {
298
+ this.description = permissions.filter(item => {
299
+ return item.value === this.permission.value;
300
+ }).map(item => {
301
+ return item.description;
302
+ })[0];
303
+ });
304
+ }
305
+ }
306
+ FsAclPermissionPopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclPermissionPopoverComponent, deps: [{ token: FsAppAclService }], target: i0.ɵɵFactoryTarget.Component });
307
+ 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"] }] });
308
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclPermissionPopoverComponent, decorators: [{
309
+ type: Component,
310
+ args: [{
311
+ selector: 'acl-permission-popover',
312
+ templateUrl: './acl-permission-popover.component.html',
313
+ styleUrls: ['./acl-permission-popover.component.scss']
314
+ }]
315
+ }], ctorParameters: function () { return [{ type: FsAppAclService }]; }, propDecorators: { permission: [{
316
+ type: Input
317
317
  }] } });
318
318
 
319
- class FsAclRolesComponent {
320
- constructor(_appAclService, _dialog) {
321
- this._appAclService = _appAclService;
322
- this._dialog = _dialog;
323
- this.aclLevels = [];
324
- this.list = new QueryList();
325
- this.indexedAclRoleLevels = {};
326
- this._destroy$ = new Subject();
327
- }
328
- ngOnInit() {
329
- new Observable(observer => {
330
- if (this.aclLevels.length) {
331
- observer.next(this.aclLevels);
332
- observer.complete();
333
- }
334
- else {
335
- this._appAclService.getLevels()
336
- .subscribe((aclLevels) => {
337
- observer.next(aclLevels);
338
- observer.complete();
339
- });
340
- }
341
- })
342
- .subscribe((aclLevels) => {
343
- this.aclLevels = aclLevels;
344
- this.indexedAclRoleLevels = list(this.aclLevels, 'name', 'value');
345
- this._loadListConfig();
346
- });
347
- }
348
- openDialog(aclRole = { id: null }) {
349
- const dialogRef = this._dialog.open(FsAclRoleComponent, {
350
- width: '70%',
351
- data: {
352
- aclRole,
353
- aclLevels: this.aclLevels,
354
- loadAclRole: this.loadAclRole,
355
- saveAclRole: this.saveAclRole,
356
- loadRoleConfigs: this.loadRoleConfigs,
357
- },
358
- });
359
- dialogRef.afterClosed()
360
- .pipe(takeUntil(this._destroy$), filter((response) => !!response))
361
- .subscribe((response) => {
362
- this.list.forEach((list) => {
363
- list.reload();
364
- });
365
- });
366
- }
367
- ngOnDestroy() {
368
- this._destroy$.next();
369
- this._destroy$.complete();
370
- }
371
- _loadListConfig() {
372
- this.listConfig = {
373
- sort: { value: 'hierarchy' },
374
- filters: [
375
- {
376
- name: 'keyword',
377
- type: ItemType.Keyword,
378
- label: 'Search',
379
- },
380
- {
381
- name: 'level',
382
- label: 'Level',
383
- type: ItemType.Select,
384
- values: this.aclLevels,
385
- hide: this.aclLevels.length <= 1
386
- },
387
- {
388
- name: 'state',
389
- label: 'Show Deleted',
390
- type: ItemType.Checkbox,
391
- unchecked: 'active',
392
- checked: 'deleted',
393
- },
394
- ],
395
- actions: [
396
- {
397
- click: (event) => {
398
- this.openDialog();
399
- },
400
- label: 'Create',
401
- },
402
- ],
403
- rowActions: [
404
- {
405
- click: (data) => {
406
- return this.deleteAclRole(data);
407
- },
408
- remove: {
409
- title: 'Confirm',
410
- template: 'Are you sure you would like to delete this role?',
411
- },
412
- menu: true,
413
- label: 'Delete',
414
- show: (row) => row.state !== 'deleted',
415
- },
416
- ],
417
- fetch: (query) => {
418
- query.permissions = true;
419
- return this.loadAclRoles(query)
420
- .pipe(map((data) => data));
421
- },
422
- };
423
- }
424
- }
425
- FsAclRolesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolesComponent, deps: [{ token: FsAppAclService }, { token: i2.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
426
- 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", loadRoleConfigs: "loadRoleConfigs", 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 <ng-container *ngIf=\"row.state !== 'deleted' else deletedRole\">\n <a (click)=\"openDialog(row)\">{{ row.name }}</a>\n </ng-container>\n <ng-template #deletedRole>\n {{ row.name }}\n </ng-template>\n <div class=\"small\">{{row.description}}</div>\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 });
427
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolesComponent, decorators: [{
428
- type: Component,
429
- args: [{
430
- selector: 'fs-acl-roles',
431
- templateUrl: 'acl-roles.component.html',
432
- styleUrls: ['acl-roles.component.scss'],
433
- changeDetection: ChangeDetectionStrategy.OnPush,
434
- }]
435
- }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialog }]; }, propDecorators: { deleteAclRole: [{
436
- type: Input
437
- }], saveAclRole: [{
438
- type: Input
439
- }], loadAclRoles: [{
440
- type: Input
441
- }], loadAclRole: [{
442
- type: Input
443
- }], loadRoleConfigs: [{
444
- type: Input
445
- }], aclLevels: [{
446
- type: Input
447
- }], list: [{
448
- type: ViewChildren,
449
- args: [FsListComponent]
319
+ class FsAclRolesComponent {
320
+ constructor(_appAclService, _dialog) {
321
+ this._appAclService = _appAclService;
322
+ this._dialog = _dialog;
323
+ this.aclLevels = [];
324
+ this.list = new QueryList();
325
+ this.indexedAclRoleLevels = {};
326
+ this._destroy$ = new Subject();
327
+ }
328
+ ngOnInit() {
329
+ new Observable(observer => {
330
+ if (this.aclLevels.length) {
331
+ observer.next(this.aclLevels);
332
+ observer.complete();
333
+ }
334
+ else {
335
+ this._appAclService.getLevels()
336
+ .subscribe((aclLevels) => {
337
+ observer.next(aclLevels);
338
+ observer.complete();
339
+ });
340
+ }
341
+ })
342
+ .subscribe((aclLevels) => {
343
+ this.aclLevels = aclLevels;
344
+ this.indexedAclRoleLevels = list(this.aclLevels, 'name', 'value');
345
+ this._loadListConfig();
346
+ });
347
+ }
348
+ openDialog(aclRole = { id: null }) {
349
+ const dialogRef = this._dialog.open(FsAclRoleComponent, {
350
+ width: '70%',
351
+ data: {
352
+ aclRole,
353
+ aclLevels: this.aclLevels,
354
+ loadAclRole: this.loadAclRole,
355
+ saveAclRole: this.saveAclRole,
356
+ loadRoleConfigs: this.loadRoleConfigs,
357
+ },
358
+ });
359
+ dialogRef.afterClosed()
360
+ .pipe(takeUntil(this._destroy$), filter((response) => !!response))
361
+ .subscribe((response) => {
362
+ this.list.forEach((list) => {
363
+ list.reload();
364
+ });
365
+ });
366
+ }
367
+ ngOnDestroy() {
368
+ this._destroy$.next();
369
+ this._destroy$.complete();
370
+ }
371
+ _loadListConfig() {
372
+ this.listConfig = {
373
+ sort: { value: 'hierarchy' },
374
+ filters: [
375
+ {
376
+ name: 'keyword',
377
+ type: ItemType.Keyword,
378
+ label: 'Search',
379
+ },
380
+ {
381
+ name: 'level',
382
+ label: 'Level',
383
+ type: ItemType.Select,
384
+ values: this.aclLevels,
385
+ hide: this.aclLevels.length <= 1
386
+ },
387
+ {
388
+ name: 'state',
389
+ label: 'Show Deleted',
390
+ type: ItemType.Checkbox,
391
+ unchecked: 'active',
392
+ checked: 'deleted',
393
+ },
394
+ ],
395
+ actions: [
396
+ {
397
+ click: (event) => {
398
+ this.openDialog();
399
+ },
400
+ label: 'Create',
401
+ },
402
+ ],
403
+ rowActions: [
404
+ {
405
+ click: (data) => {
406
+ return this.deleteAclRole(data);
407
+ },
408
+ remove: {
409
+ title: 'Confirm',
410
+ template: 'Are you sure you would like to delete this role?',
411
+ },
412
+ menu: true,
413
+ label: 'Delete',
414
+ show: (row) => row.state !== 'deleted',
415
+ },
416
+ {
417
+ click: (data) => {
418
+ return this.restoreAclRole(data)
419
+ .pipe(tap(() => {
420
+ this.list.forEach((l) => {
421
+ l.reload();
422
+ });
423
+ }), takeUntil(this._destroy$))
424
+ .subscribe();
425
+ },
426
+ label: 'Restore',
427
+ show: (row) => row.state === 'deleted',
428
+ },
429
+ ],
430
+ fetch: (query) => {
431
+ query.permissions = true;
432
+ return this.loadAclRoles(query)
433
+ .pipe(map((data) => data));
434
+ },
435
+ };
436
+ }
437
+ }
438
+ FsAclRolesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolesComponent, deps: [{ token: FsAppAclService }, { token: i2.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
439
+ FsAclRolesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclRolesComponent, selector: "fs-acl-roles", inputs: { deleteAclRole: "deleteAclRole", restoreAclRole: "restoreAclRole", saveAclRole: "saveAclRole", loadAclRoles: "loadAclRoles", loadAclRole: "loadAclRole", loadRoleConfigs: "loadRoleConfigs", 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 <ng-container *ngIf=\"row.state !== 'deleted' else deletedRole\">\n <a (click)=\"openDialog(row)\">{{ row.name }}</a>\n </ng-container>\n <ng-template #deletedRole>\n {{ row.name }}\n </ng-template>\n <div class=\"small\">{{row.description}}</div>\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 });
440
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolesComponent, decorators: [{
441
+ type: Component,
442
+ args: [{
443
+ selector: 'fs-acl-roles',
444
+ templateUrl: 'acl-roles.component.html',
445
+ styleUrls: ['acl-roles.component.scss'],
446
+ changeDetection: ChangeDetectionStrategy.OnPush,
447
+ }]
448
+ }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialog }]; }, propDecorators: { deleteAclRole: [{
449
+ type: Input
450
+ }], restoreAclRole: [{
451
+ type: Input
452
+ }], saveAclRole: [{
453
+ type: Input
454
+ }], loadAclRoles: [{
455
+ type: Input
456
+ }], loadAclRole: [{
457
+ type: Input
458
+ }], loadRoleConfigs: [{
459
+ type: Input
460
+ }], aclLevels: [{
461
+ type: Input
462
+ }], list: [{
463
+ type: ViewChildren,
464
+ args: [FsListComponent]
450
465
  }] } });
451
466
 
452
- class FsAclRolePopoverComponent {
453
- constructor(_appAclService) {
454
- this._appAclService = _appAclService;
455
- this.permissions = [];
456
- }
457
- ngOnInit() {
458
- const aclRolePermissions = this.aclRole.permissions || [];
459
- this._appAclService.getPermissions()
460
- .subscribe((response) => {
461
- this.permissions = response.filter(item => {
462
- return aclRolePermissions.some(permission => {
463
- return item.value === permission.value;
464
- });
465
- });
466
- });
467
- }
468
- }
469
- FsAclRolePopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolePopoverComponent, deps: [{ token: FsAppAclService }], target: i0.ɵɵFactoryTarget.Component });
470
- 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"] }] });
471
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolePopoverComponent, decorators: [{
472
- type: Component,
473
- args: [{
474
- selector: 'fs-acl-role-popover',
475
- templateUrl: './acl-role-popover.component.html',
476
- styleUrls: ['./acl-role-popover.component.scss']
477
- }]
478
- }], ctorParameters: function () { return [{ type: FsAppAclService }]; }, propDecorators: { aclRole: [{
479
- type: Input
480
- }], objectName: [{
481
- type: Input
467
+ class FsAclRolePopoverComponent {
468
+ constructor(_appAclService) {
469
+ this._appAclService = _appAclService;
470
+ this.permissions = [];
471
+ }
472
+ ngOnInit() {
473
+ const aclRolePermissions = this.aclRole.permissions || [];
474
+ this._appAclService.getPermissions()
475
+ .subscribe((response) => {
476
+ this.permissions = response.filter(item => {
477
+ return aclRolePermissions.some(permission => {
478
+ return item.value === permission.value;
479
+ });
480
+ });
481
+ });
482
+ }
483
+ }
484
+ FsAclRolePopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolePopoverComponent, deps: [{ token: FsAppAclService }], target: i0.ɵɵFactoryTarget.Component });
485
+ 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"] }] });
486
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclRolePopoverComponent, decorators: [{
487
+ type: Component,
488
+ args: [{
489
+ selector: 'fs-acl-role-popover',
490
+ templateUrl: './acl-role-popover.component.html',
491
+ styleUrls: ['./acl-role-popover.component.scss']
492
+ }]
493
+ }], ctorParameters: function () { return [{ type: FsAppAclService }]; }, propDecorators: { aclRole: [{
494
+ type: Input
495
+ }], objectName: [{
496
+ type: Input
482
497
  }] } });
483
498
 
484
- class FsAclObjectRolesComponent {
485
- constructor() {
486
- this.aclRoles = [];
487
- this.required = false;
488
- this.multiple = false;
489
- this.disabled = false;
490
- this.aclObjectRoles = [];
491
- this.rolesLabel = 'Roles';
492
- this.levelLabel = '';
493
- this.change = new EventEmitter();
494
- this.compareAclRole = (o1, o2) => {
495
- return o1 && o2 && o1.id === o2.id;
496
- };
497
- }
498
- changed() {
499
- this.change.emit(this.aclObjectRoles);
500
- }
501
- }
502
- FsAclObjectRolesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclObjectRolesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
503
- 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 }] });
504
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclObjectRolesComponent, decorators: [{
505
- type: Component,
506
- args: [{
507
- selector: 'fs-acl-object-roles',
508
- templateUrl: './acl-object-roles.component.html',
509
- styleUrls: ['./acl-object-roles.component.scss'],
510
- viewProviders: [{ provide: ControlContainer, useExisting: NgForm }]
511
- }]
512
- }], propDecorators: { aclRoles: [{
513
- type: Input
514
- }], required: [{
515
- type: Input
516
- }], multiple: [{
517
- type: Input
518
- }], disabled: [{
519
- type: Input
520
- }], aclObjectRoles: [{
521
- type: Input
522
- }], rolesLabel: [{
523
- type: Input
524
- }], levelLabel: [{
525
- type: Input
526
- }], change: [{
527
- type: Output
499
+ class FsAclObjectRolesComponent {
500
+ constructor() {
501
+ this.aclRoles = [];
502
+ this.required = false;
503
+ this.multiple = false;
504
+ this.disabled = false;
505
+ this.aclObjectRoles = [];
506
+ this.rolesLabel = 'Roles';
507
+ this.levelLabel = '';
508
+ this.change = new EventEmitter();
509
+ this.compareAclRole = (o1, o2) => {
510
+ return o1 && o2 && o1.id === o2.id;
511
+ };
512
+ }
513
+ changed() {
514
+ this.change.emit(this.aclObjectRoles);
515
+ }
516
+ }
517
+ FsAclObjectRolesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclObjectRolesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
518
+ 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]=\"$any(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 }] });
519
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclObjectRolesComponent, decorators: [{
520
+ type: Component,
521
+ args: [{
522
+ selector: 'fs-acl-object-roles',
523
+ templateUrl: './acl-object-roles.component.html',
524
+ styleUrls: ['./acl-object-roles.component.scss'],
525
+ viewProviders: [{ provide: ControlContainer, useExisting: NgForm }]
526
+ }]
527
+ }], propDecorators: { aclRoles: [{
528
+ type: Input
529
+ }], required: [{
530
+ type: Input
531
+ }], multiple: [{
532
+ type: Input
533
+ }], disabled: [{
534
+ type: Input
535
+ }], aclObjectRoles: [{
536
+ type: Input
537
+ }], rolesLabel: [{
538
+ type: Input
539
+ }], levelLabel: [{
540
+ type: Input
541
+ }], change: [{
542
+ type: Output
528
543
  }] } });
529
544
 
530
- class FsAclEntryComponent {
531
- constructor(_appAclService, _dialogRef, _message, _data) {
532
- var _a;
533
- this._appAclService = _appAclService;
534
- this._dialogRef = _dialogRef;
535
- this._message = _message;
536
- this._data = _data;
537
- this.aclRoles = [];
538
- this.aclEntries = [];
539
- this.indexedAclRoleLevels = {};
540
- this.titleEdit = 'Edit Roles';
541
- this.titleAdd = 'Assign Roles';
542
- this.required = true;
543
- this.save = () => {
544
- const aclObjectEntry = Object.assign(Object.assign({}, this.aclObjectEntry), { aclEntries: this.aclEntries });
545
- return this._data.saveAclObjectEntry(aclObjectEntry)
546
- .subscribe((data) => {
547
- this._message.success('Saved Changes');
548
- this.close(data);
549
- });
550
- };
551
- this.aclObjectEntry = Object.assign({}, _data.aclObjectEntry);
552
- this.required = (_a = _data.required) !== null && _a !== void 0 ? _a : true;
553
- if (_data.titleEdit) {
554
- this.titleEdit = _data.titleEdit;
555
- }
556
- if (_data.titleAdd) {
557
- this.titleAdd = _data.titleAdd;
558
- }
559
- }
560
- ngOnInit() {
561
- forkJoin(this._data.loadAclRoles(this.aclObjectEntry), this._appAclService.getIndexedLevels())
562
- .subscribe(([aclRoles, levels,]) => {
563
- this.aclRoles = aclRoles;
564
- this.indexedAclRoleLevels = levels;
565
- this.aclObjectRole = {
566
- object: this.aclObjectEntry.object,
567
- aclRoles: this.aclObjectEntry.aclEntries
568
- .map((aclEntry) => {
569
- return aclEntry.aclRole;
570
- }),
571
- };
572
- });
573
- }
574
- aclObjectRoleChange(aclObjectRoles) {
575
- this.aclEntries = aclObjectRoles.reduce((aclEntries, aclObjectRole) => {
576
- aclObjectRole.aclRoles.forEach(aclRole => {
577
- aclEntries.push({
578
- aclRoleId: aclRole.id,
579
- aclRole: aclRole,
580
- objectId: aclObjectRole.object ? aclObjectRole.object.id : null,
581
- object: aclObjectRole.object || null
582
- });
583
- });
584
- return aclEntries;
585
- }, []);
586
- }
587
- close(data = null) {
588
- this._dialogRef.close(data);
589
- }
590
- }
591
- 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 });
592
- 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"] }] });
593
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclEntryComponent, decorators: [{
594
- type: Component,
595
- args: [{
596
- templateUrl: './acl-entry.component.html',
597
- styleUrls: ['./acl-entry.component.scss'],
598
- }]
599
- }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialogRef }, { type: i3.FsMessage }, { type: undefined, decorators: [{
600
- type: Inject,
601
- args: [MAT_DIALOG_DATA]
545
+ class FsAclEntryComponent {
546
+ constructor(_appAclService, _dialogRef, _message, _data) {
547
+ var _a;
548
+ this._appAclService = _appAclService;
549
+ this._dialogRef = _dialogRef;
550
+ this._message = _message;
551
+ this._data = _data;
552
+ this.aclRoles = [];
553
+ this.aclEntries = [];
554
+ this.indexedAclRoleLevels = {};
555
+ this.titleEdit = 'Edit Roles';
556
+ this.titleAdd = 'Assign Roles';
557
+ this.required = true;
558
+ this.save = () => {
559
+ const aclObjectEntry = Object.assign(Object.assign({}, this.aclObjectEntry), { aclEntries: this.aclEntries });
560
+ return this._data.saveAclObjectEntry(aclObjectEntry)
561
+ .pipe(tap((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 || null,
579
+ }), this._appAclService.getIndexedLevels())
580
+ .subscribe(([aclRoles, levels,]) => {
581
+ this.aclRoles = aclRoles;
582
+ this.indexedAclRoleLevels = levels;
583
+ this.aclObjectRole = {
584
+ object: this.aclObjectEntry.object,
585
+ aclRoles: this.aclObjectEntry.aclEntries
586
+ .map((aclEntry) => {
587
+ return aclEntry.aclRole;
588
+ }),
589
+ };
590
+ });
591
+ }
592
+ aclObjectRoleChange(aclObjectRoles) {
593
+ this.aclEntries = aclObjectRoles.reduce((aclEntries, aclObjectRole) => {
594
+ aclObjectRole.aclRoles.forEach(aclRole => {
595
+ aclEntries.push({
596
+ aclRoleId: aclRole.id,
597
+ aclRole: aclRole,
598
+ objectId: aclObjectRole.object ? aclObjectRole.object.id : null,
599
+ object: aclObjectRole.object || null
600
+ });
601
+ });
602
+ return aclEntries;
603
+ }, []);
604
+ }
605
+ close(data = null) {
606
+ this._dialogRef.close(data);
607
+ }
608
+ }
609
+ 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 });
610
+ 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"] }] });
611
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclEntryComponent, decorators: [{
612
+ type: Component,
613
+ args: [{
614
+ templateUrl: './acl-entry.component.html',
615
+ styleUrls: ['./acl-entry.component.scss'],
616
+ }]
617
+ }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialogRef }, { type: i3.FsMessage }, { type: undefined, decorators: [{
618
+ type: Inject,
619
+ args: [MAT_DIALOG_DATA]
602
620
  }] }]; } });
603
621
 
604
- class FsAclEntriesComponent {
605
- constructor(_appAclService, _dialog, _confirm) {
606
- this._appAclService = _appAclService;
607
- this._dialog = _dialog;
608
- this._confirm = _confirm;
609
- this.environmentShow = true;
610
- this.environmentLabel = 'Environment';
611
- this.environmentKey = 'environment';
612
- this.actions = [];
613
- this.aclEntriesList = null;
614
- this.aclEntriesConfig = null;
615
- this.permissions = [];
616
- this._destroy$ = new Subject();
617
- }
618
- ngOnInit() {
619
- this._appAclService.getPermissions()
620
- .subscribe(response => {
621
- this.permissions = response;
622
- });
623
- this.aclEntriesConfig = {
624
- status: false,
625
- paging: false,
626
- actions: this.actions,
627
- rowActions: [
628
- {
629
- label: 'Remove All Roles',
630
- click: (aclObjectEntry) => {
631
- this._confirm
632
- .confirm({
633
- title: 'Remove All Roles',
634
- template: 'Are you sure you would like to remove all roles?',
635
- }).subscribe(() => {
636
- const data = Object.assign(Object.assign({}, aclObjectEntry), { aclEntries: [] });
637
- this.saveAclObjectEntry(data)
638
- .subscribe(() => {
639
- this.aclEntriesList.reload();
640
- });
641
- });
642
- }
643
- }
644
- ],
645
- fetch: () => {
646
- return new Observable((observer) => {
647
- this.loadAclEntries({
648
- aclRoles: true,
649
- aclRolePermissions: true,
650
- objects: true,
651
- aclRoleState: 'active',
652
- })
653
- .subscribe((aclEntries) => {
654
- const objects = aclEntries
655
- .filter((aclEntry) => (!!aclEntry.object))
656
- .reduce((items, item) => {
657
- return Object.assign(Object.assign({}, items), { [item.object.id]: item.object });
658
- }, {});
659
- const environments = aclEntries
660
- .filter((aclEntry) => (!!aclEntry[this.environmentKey]))
661
- .reduce((items, item) => {
662
- const environment = item[this.environmentKey];
663
- return Object.assign(Object.assign({}, items), { [environment.id]: environment });
664
- }, {});
665
- const groupedAclEntries = groupBy(aclEntries, (item) => {
666
- var _a;
667
- const environmentId = (_a = (item[this.environmentKey])) === null || _a === void 0 ? void 0 : _a.id;
668
- return [item.aclRole.level, environmentId, item.objectId];
669
- });
670
- let aclObjectEntries = Object.keys(groupedAclEntries)
671
- .reduce((accum, key) => {
672
- const parts = key.split(',');
673
- return [
674
- ...accum,
675
- {
676
- object: objects[parts[2]],
677
- level: parts[0],
678
- [`${this.environmentKey}Id`]: parts[1] ? parseInt(parts[1]) : null,
679
- [this.environmentKey]: environments[parts[1]],
680
- aclEntries: groupedAclEntries[key],
681
- }
682
- ];
683
- }, []);
684
- const hasApp = aclObjectEntries.some((item) => {
685
- return item.aclEntries.some((entry) => {
686
- return !entry.objectId;
687
- });
688
- });
689
- if (!hasApp) {
690
- aclObjectEntries.unshift({
691
- object: null,
692
- aclEntries: [],
693
- level: 'app',
694
- environmentId: null,
695
- });
696
- }
697
- aclObjectEntries = sortBy(aclObjectEntries, (item) => {
698
- return item.object ? item.level : '';
699
- });
700
- observer.next({ data: aclObjectEntries });
701
- observer.complete();
702
- });
703
- });
704
- },
705
- };
706
- }
707
- update(aclObjectEntry) {
708
- const data = {
709
- aclObjectEntry,
710
- required: false,
711
- loadAclRoles: this.loadAclRoles,
712
- saveAclObjectEntry: this.saveAclObjectEntry
713
- };
714
- this._dialog.open(FsAclEntryComponent, {
715
- data: data
716
- })
717
- .afterClosed()
718
- .pipe(takeUntil(this._destroy$))
719
- .subscribe(() => {
720
- this.aclEntriesList.reload();
721
- });
722
- }
723
- ngOnDestroy() {
724
- this._destroy$.next();
725
- this._destroy$.complete();
726
- }
727
- reload() {
728
- this.aclEntriesList.reload();
729
- }
730
- }
731
- 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 });
732
- 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]" }] });
733
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclEntriesComponent, decorators: [{
734
- type: Component,
735
- args: [{
736
- selector: 'fs-acl-entries',
737
- templateUrl: './acl-entries.component.html',
738
- styleUrls: ['./acl-entries.component.scss']
739
- }]
740
- }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialog }, { type: i3$1.FsPrompt }]; }, propDecorators: { loadAclEntries: [{
741
- type: Input
742
- }], loadAclRoles: [{
743
- type: Input
744
- }], saveAclObjectEntry: [{
745
- type: Input
746
- }], environmentShow: [{
747
- type: Input
748
- }], environmentLabel: [{
749
- type: Input
750
- }], environmentKey: [{
751
- type: Input
752
- }], actions: [{
753
- type: Input
754
- }], aclEntriesList: [{
755
- type: ViewChild,
756
- args: [FsListComponent]
622
+ class FsAclEntriesComponent {
623
+ constructor(_appAclService, _dialog, _confirm) {
624
+ this._appAclService = _appAclService;
625
+ this._dialog = _dialog;
626
+ this._confirm = _confirm;
627
+ this.environmentShow = true;
628
+ this.environmentLabel = 'Environment';
629
+ this.environmentKey = '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
+ commitLabel: 'Save',
653
+ template: `Please note that removing roles may prevent users from being able to successfully login.<br>
654
+ These changes are effective immediately.<br>
655
+ Are you sure you would like to continue?`,
656
+ }).subscribe(() => {
657
+ const data = Object.assign(Object.assign({}, aclObjectEntry), { aclEntries: [] });
658
+ this.saveAclObjectEntry(data)
659
+ .subscribe(() => {
660
+ this.aclEntriesList.reload();
661
+ });
662
+ });
663
+ }
664
+ }
665
+ ],
666
+ fetch: () => {
667
+ return new Observable((observer) => {
668
+ this.loadAclEntries({
669
+ aclRoles: true,
670
+ aclRolePermissions: true,
671
+ objects: true,
672
+ aclRoleState: 'active',
673
+ })
674
+ .subscribe((aclEntries) => {
675
+ const objects = aclEntries
676
+ .filter((aclEntry) => (!!aclEntry.object))
677
+ .reduce((items, item) => {
678
+ return Object.assign(Object.assign({}, items), { [item.object.id]: item.object });
679
+ }, {});
680
+ const environments = aclEntries
681
+ .filter((aclEntry) => (!!aclEntry[this.environmentKey]))
682
+ .reduce((items, item) => {
683
+ const environment = item[this.environmentKey];
684
+ return Object.assign(Object.assign({}, items), { [environment.id]: environment });
685
+ }, {});
686
+ const groupedAclEntries = groupBy(aclEntries, (item) => {
687
+ var _a;
688
+ const environmentId = (_a = (item[this.environmentKey])) === null || _a === void 0 ? void 0 : _a.id;
689
+ return [item.aclRole.level, environmentId, item.objectId];
690
+ });
691
+ let aclObjectEntries = Object.keys(groupedAclEntries)
692
+ .reduce((accum, key) => {
693
+ const parts = key.split(',');
694
+ return [
695
+ ...accum,
696
+ {
697
+ object: objects[parts[2]],
698
+ level: parts[0],
699
+ [`${this.environmentKey}Id`]: parts[1] ? parseInt(parts[1]) : null,
700
+ [this.environmentKey]: environments[parts[1]],
701
+ aclEntries: groupedAclEntries[key],
702
+ }
703
+ ];
704
+ }, []);
705
+ const hasApp = aclObjectEntries.some((item) => {
706
+ return item.aclEntries.some((entry) => {
707
+ return !entry.objectId;
708
+ });
709
+ });
710
+ if (!hasApp) {
711
+ aclObjectEntries.unshift({
712
+ object: null,
713
+ aclEntries: [],
714
+ level: 'app',
715
+ environmentId: null,
716
+ });
717
+ }
718
+ aclObjectEntries = sortBy(aclObjectEntries, (item) => {
719
+ return item.object ? item.level : '';
720
+ });
721
+ observer.next({ data: aclObjectEntries });
722
+ observer.complete();
723
+ });
724
+ });
725
+ },
726
+ };
727
+ }
728
+ update(aclObjectEntry) {
729
+ const data = {
730
+ aclObjectEntry,
731
+ required: false,
732
+ loadAclRoles: this.loadAclRoles,
733
+ saveAclObjectEntry: this.saveAclObjectEntry
734
+ };
735
+ this._dialog.open(FsAclEntryComponent, {
736
+ data: data
737
+ })
738
+ .afterClosed()
739
+ .pipe(takeUntil(this._destroy$))
740
+ .subscribe(() => {
741
+ this.aclEntriesList.reload();
742
+ });
743
+ }
744
+ ngOnDestroy() {
745
+ this._destroy$.next();
746
+ this._destroy$.complete();
747
+ }
748
+ reload() {
749
+ this.aclEntriesList.reload();
750
+ }
751
+ }
752
+ 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 });
753
+ 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]" }] });
754
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclEntriesComponent, decorators: [{
755
+ type: Component,
756
+ args: [{
757
+ selector: 'fs-acl-entries',
758
+ templateUrl: './acl-entries.component.html',
759
+ styleUrls: ['./acl-entries.component.scss']
760
+ }]
761
+ }], ctorParameters: function () { return [{ type: FsAppAclService }, { type: i2.MatDialog }, { type: i3$1.FsPrompt }]; }, propDecorators: { loadAclEntries: [{
762
+ type: Input
763
+ }], loadAclRoles: [{
764
+ type: Input
765
+ }], saveAclObjectEntry: [{
766
+ type: Input
767
+ }], environmentShow: [{
768
+ type: Input
769
+ }], environmentLabel: [{
770
+ type: Input
771
+ }], environmentKey: [{
772
+ type: Input
773
+ }], actions: [{
774
+ type: Input
775
+ }], aclEntriesList: [{
776
+ type: ViewChild,
777
+ args: [FsListComponent]
757
778
  }] } });
758
779
 
759
- class FsAppAclModule {
760
- }
761
- FsAppAclModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
762
- FsAppAclModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, declarations: [FsAclRolesComponent,
763
- FsAclPermissionPopoverComponent,
764
- FsAclRoleComponent,
765
- FsAclEntriesComponent,
766
- FsAclRolePopoverComponent,
767
- FsAclObjectRolesComponent,
768
- FsAclEntryComponent], imports: [CommonModule,
769
- FormsModule,
770
- MatDialogModule,
771
- MatFormFieldModule,
772
- MatCheckboxModule,
773
- MatSelectModule,
774
- MatButtonModule,
775
- MatRadioModule,
776
- MatInputModule,
777
- FlexLayoutModule,
778
- FsListModule,
779
- FsPopoverModule,
780
- FsDialogModule,
781
- FsFormModule,
782
- FsLabelModule,
783
- FsRadioGroupModule,
784
- FsBadgeModule,
785
- FsCheckboxGroupModule], exports: [FsAclRolesComponent,
786
- FsAclPermissionPopoverComponent,
787
- FsAclRoleComponent,
788
- FsAclEntriesComponent,
789
- FsAclRolePopoverComponent,
790
- FsAclObjectRolesComponent,
791
- FsAclEntryComponent] });
792
- FsAppAclModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, imports: [[
793
- CommonModule,
794
- FormsModule,
795
- MatDialogModule,
796
- MatFormFieldModule,
797
- MatCheckboxModule,
798
- MatSelectModule,
799
- MatButtonModule,
800
- MatRadioModule,
801
- MatInputModule,
802
- FlexLayoutModule,
803
- FsListModule,
804
- FsPopoverModule,
805
- FsDialogModule,
806
- FsFormModule,
807
- FsLabelModule,
808
- FsRadioGroupModule,
809
- FsBadgeModule,
810
- FsCheckboxGroupModule,
811
- ]] });
812
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, decorators: [{
813
- type: NgModule,
814
- args: [{
815
- imports: [
816
- CommonModule,
817
- FormsModule,
818
- MatDialogModule,
819
- MatFormFieldModule,
820
- MatCheckboxModule,
821
- MatSelectModule,
822
- MatButtonModule,
823
- MatRadioModule,
824
- MatInputModule,
825
- FlexLayoutModule,
826
- FsListModule,
827
- FsPopoverModule,
828
- FsDialogModule,
829
- FsFormModule,
830
- FsLabelModule,
831
- FsRadioGroupModule,
832
- FsBadgeModule,
833
- FsCheckboxGroupModule,
834
- ],
835
- declarations: [
836
- FsAclRolesComponent,
837
- FsAclPermissionPopoverComponent,
838
- FsAclRoleComponent,
839
- FsAclEntriesComponent,
840
- FsAclRolePopoverComponent,
841
- FsAclObjectRolesComponent,
842
- FsAclEntryComponent,
843
- ],
844
- exports: [
845
- FsAclRolesComponent,
846
- FsAclPermissionPopoverComponent,
847
- FsAclRoleComponent,
848
- FsAclEntriesComponent,
849
- FsAclRolePopoverComponent,
850
- FsAclObjectRolesComponent,
851
- FsAclEntryComponent,
852
- ],
853
- }]
780
+ class FsAppAclModule {
781
+ }
782
+ FsAppAclModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
783
+ FsAppAclModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, declarations: [FsAclRolesComponent,
784
+ FsAclPermissionPopoverComponent,
785
+ FsAclRoleComponent,
786
+ FsAclEntriesComponent,
787
+ FsAclRolePopoverComponent,
788
+ FsAclObjectRolesComponent,
789
+ FsAclEntryComponent], imports: [CommonModule,
790
+ FormsModule,
791
+ MatDialogModule,
792
+ MatFormFieldModule,
793
+ MatCheckboxModule,
794
+ MatSelectModule,
795
+ MatButtonModule,
796
+ MatRadioModule,
797
+ MatInputModule,
798
+ FlexLayoutModule,
799
+ FsListModule,
800
+ FsPopoverModule,
801
+ FsDialogModule,
802
+ FsFormModule,
803
+ FsLabelModule,
804
+ FsRadioGroupModule,
805
+ FsBadgeModule,
806
+ FsCheckboxGroupModule], exports: [FsAclRolesComponent,
807
+ FsAclPermissionPopoverComponent,
808
+ FsAclRoleComponent,
809
+ FsAclEntriesComponent,
810
+ FsAclRolePopoverComponent,
811
+ FsAclObjectRolesComponent,
812
+ FsAclEntryComponent] });
813
+ FsAppAclModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, imports: [[
814
+ CommonModule,
815
+ FormsModule,
816
+ MatDialogModule,
817
+ MatFormFieldModule,
818
+ MatCheckboxModule,
819
+ MatSelectModule,
820
+ MatButtonModule,
821
+ MatRadioModule,
822
+ MatInputModule,
823
+ FlexLayoutModule,
824
+ FsListModule,
825
+ FsPopoverModule,
826
+ FsDialogModule,
827
+ FsFormModule,
828
+ FsLabelModule,
829
+ FsRadioGroupModule,
830
+ FsBadgeModule,
831
+ FsCheckboxGroupModule,
832
+ ]] });
833
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclModule, decorators: [{
834
+ type: NgModule,
835
+ args: [{
836
+ imports: [
837
+ CommonModule,
838
+ FormsModule,
839
+ MatDialogModule,
840
+ MatFormFieldModule,
841
+ MatCheckboxModule,
842
+ MatSelectModule,
843
+ MatButtonModule,
844
+ MatRadioModule,
845
+ MatInputModule,
846
+ FlexLayoutModule,
847
+ FsListModule,
848
+ FsPopoverModule,
849
+ FsDialogModule,
850
+ FsFormModule,
851
+ FsLabelModule,
852
+ FsRadioGroupModule,
853
+ FsBadgeModule,
854
+ FsCheckboxGroupModule,
855
+ ],
856
+ declarations: [
857
+ FsAclRolesComponent,
858
+ FsAclPermissionPopoverComponent,
859
+ FsAclRoleComponent,
860
+ FsAclEntriesComponent,
861
+ FsAclRolePopoverComponent,
862
+ FsAclObjectRolesComponent,
863
+ FsAclEntryComponent,
864
+ ],
865
+ exports: [
866
+ FsAclRolesComponent,
867
+ FsAclPermissionPopoverComponent,
868
+ FsAclRoleComponent,
869
+ FsAclEntriesComponent,
870
+ FsAclRolePopoverComponent,
871
+ FsAclObjectRolesComponent,
872
+ FsAclEntryComponent,
873
+ ],
874
+ }]
854
875
  }] });
855
876
 
856
- /**
857
- * Generated bundle index. Do not edit.
877
+ /**
878
+ * Generated bundle index. Do not edit.
858
879
  */
859
880
 
860
881
  export { FS_APP_ACL_CONFIG, FsAclEntriesComponent, FsAclEntryComponent, FsAclObjectRolesComponent, FsAclPermissionPopoverComponent, FsAclRoleComponent, FsAclRolePopoverComponent, FsAclRolesComponent, FsAppAclModule, FsAppAclService };