@firestitch/app-acl 12.3.7 → 12.3.9

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