@firestitch/app-acl 12.2.0 → 12.3.2

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