@firestitch/app-acl 12.3.1 → 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.
- package/app/components/acl-entry/acl-entry.component.d.ts +3 -1
- package/app/services/app-acl.service.d.ts +0 -2
- package/bundles/firestitch-app-acl.umd.js +31 -56
- package/bundles/firestitch-app-acl.umd.js.map +1 -1
- package/esm2015/app/components/acl-entries/acl-entries.component.js +18 -20
- package/esm2015/app/components/acl-entry/acl-entry.component.js +7 -7
- package/esm2015/app/components/acl-role/acl-role.component.js +4 -5
- package/esm2015/app/components/acl-roles/acl-roles.component.js +3 -3
- package/esm2015/app/services/app-acl.service.js +1 -24
- package/fesm2015/firestitch-app-acl.js +27 -51
- package/fesm2015/firestitch-app-acl.js.map +1 -1
- package/package.json +1 -1
|
@@ -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,6 +44,7 @@ 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
50
|
var AclRoleAccess;
|
|
@@ -74,7 +74,6 @@ class FsAppAclService {
|
|
|
74
74
|
if (!this._permissions$) {
|
|
75
75
|
this._permissions$ = new ReplaySubject();
|
|
76
76
|
this._appAclConfig.permissions
|
|
77
|
-
.pipe(map((data) => this.input(data)))
|
|
78
77
|
.subscribe((permissions) => {
|
|
79
78
|
this._permissions$.next(permissions);
|
|
80
79
|
this._permissions$.complete();
|
|
@@ -86,7 +85,6 @@ class FsAppAclService {
|
|
|
86
85
|
if (!this._levels$) {
|
|
87
86
|
this._levels$ = new ReplaySubject();
|
|
88
87
|
this._appAclConfig.levels
|
|
89
|
-
.pipe(map((data) => this.input(data)))
|
|
90
88
|
.subscribe((levels) => {
|
|
91
89
|
this._levels$.next(levels);
|
|
92
90
|
this._levels$.complete();
|
|
@@ -100,26 +98,6 @@ class FsAppAclService {
|
|
|
100
98
|
return list(data, 'name', 'value');
|
|
101
99
|
}));
|
|
102
100
|
}
|
|
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
101
|
}
|
|
124
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 });
|
|
125
103
|
FsAppAclService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAppAclService, providedIn: 'root' });
|
|
@@ -165,7 +143,7 @@ class FsAclRoleComponent {
|
|
|
165
143
|
data: item.data,
|
|
166
144
|
};
|
|
167
145
|
}) });
|
|
168
|
-
return this._data.saveAclRole(
|
|
146
|
+
return this._data.saveAclRole(aclRole)
|
|
169
147
|
.pipe(tap((response) => {
|
|
170
148
|
this._message.success('Saved Changes');
|
|
171
149
|
this.close(response);
|
|
@@ -256,8 +234,7 @@ class FsAclRoleComponent {
|
|
|
256
234
|
if (!this.environment) {
|
|
257
235
|
query.environmentId = null;
|
|
258
236
|
}
|
|
259
|
-
return this._data.loadAclRole(this._data.aclRole, query)
|
|
260
|
-
.pipe(map((data) => this._appAclService.input(data)));
|
|
237
|
+
return this._data.loadAclRole(this._data.aclRole, query);
|
|
261
238
|
}
|
|
262
239
|
close(data = null) {
|
|
263
240
|
this._dialogRef.close(data);
|
|
@@ -422,7 +399,7 @@ class FsAclRolesComponent {
|
|
|
422
399
|
rowActions: [
|
|
423
400
|
{
|
|
424
401
|
click: (data) => {
|
|
425
|
-
return this.deleteAclRole(
|
|
402
|
+
return this.deleteAclRole(data);
|
|
426
403
|
},
|
|
427
404
|
remove: {
|
|
428
405
|
title: 'Confirm',
|
|
@@ -436,7 +413,7 @@ class FsAclRolesComponent {
|
|
|
436
413
|
fetch: (query) => {
|
|
437
414
|
query.permissions = true;
|
|
438
415
|
return this.loadAclRoles(query)
|
|
439
|
-
.pipe(map((data) =>
|
|
416
|
+
.pipe(map((data) => data));
|
|
440
417
|
},
|
|
441
418
|
};
|
|
442
419
|
}
|
|
@@ -552,12 +529,14 @@ class FsAclEntryComponent {
|
|
|
552
529
|
this._message = _message;
|
|
553
530
|
this._data = _data;
|
|
554
531
|
this.aclRoles = [];
|
|
532
|
+
this.aclEntries = [];
|
|
555
533
|
this.indexedAclRoleLevels = {};
|
|
556
534
|
this.titleEdit = 'Edit Roles';
|
|
557
535
|
this.titleAdd = 'Assign Roles';
|
|
558
536
|
this.required = true;
|
|
559
537
|
this.save = () => {
|
|
560
|
-
|
|
538
|
+
const aclObjectEntry = Object.assign(Object.assign({}, this.aclObjectEntry), { aclEntries: this.aclEntries });
|
|
539
|
+
return this._data.saveAclObjectEntry(aclObjectEntry)
|
|
561
540
|
.subscribe((data) => {
|
|
562
541
|
this._message.success('Saved Changes');
|
|
563
542
|
this.close(data);
|
|
@@ -573,8 +552,7 @@ class FsAclEntryComponent {
|
|
|
573
552
|
}
|
|
574
553
|
}
|
|
575
554
|
ngOnInit() {
|
|
576
|
-
forkJoin(this._data.loadAclRoles(this.aclObjectEntry)
|
|
577
|
-
.pipe(map((data) => this._appAclService.input(data))), this._appAclService.getIndexedLevels())
|
|
555
|
+
forkJoin(this._data.loadAclRoles(this.aclObjectEntry), this._appAclService.getIndexedLevels())
|
|
578
556
|
.subscribe(([aclRoles, levels,]) => {
|
|
579
557
|
this.aclRoles = aclRoles;
|
|
580
558
|
this.indexedAclRoleLevels = levels;
|
|
@@ -583,12 +561,12 @@ class FsAclEntryComponent {
|
|
|
583
561
|
aclRoles: this.aclObjectEntry.aclEntries
|
|
584
562
|
.map((aclEntry) => {
|
|
585
563
|
return aclEntry.aclRole;
|
|
586
|
-
})
|
|
564
|
+
}),
|
|
587
565
|
};
|
|
588
566
|
});
|
|
589
567
|
}
|
|
590
568
|
aclObjectRoleChange(aclObjectRoles) {
|
|
591
|
-
this.
|
|
569
|
+
this.aclEntries = aclObjectRoles.reduce((aclEntries, aclObjectRole) => {
|
|
592
570
|
aclObjectRole.aclRoles.forEach(aclRole => {
|
|
593
571
|
aclEntries.push({
|
|
594
572
|
aclRoleId: aclRole.id,
|
|
@@ -648,7 +626,7 @@ class FsAclEntriesComponent {
|
|
|
648
626
|
title: 'Remove All Roles',
|
|
649
627
|
template: 'Are you sure you would like to remove all roles?',
|
|
650
628
|
}).subscribe(() => {
|
|
651
|
-
const data =
|
|
629
|
+
const data = Object.assign(Object.assign({}, aclObjectEntry), { aclEntries: [] });
|
|
652
630
|
this.saveAclObjectEntry(data)
|
|
653
631
|
.subscribe(() => {
|
|
654
632
|
this.aclEntriesList.reload();
|
|
@@ -665,32 +643,29 @@ class FsAclEntriesComponent {
|
|
|
665
643
|
objects: true,
|
|
666
644
|
aclRoleState: 'active',
|
|
667
645
|
})
|
|
668
|
-
.pipe(map((response) => this._appAclService.input(response)))
|
|
669
646
|
.subscribe((aclEntries) => {
|
|
670
|
-
const objects = aclEntries
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
}
|
|
674
|
-
return items;
|
|
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 });
|
|
675
651
|
}, {});
|
|
676
|
-
const environments = aclEntries
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
}
|
|
680
|
-
return items;
|
|
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 });
|
|
681
656
|
}, {});
|
|
682
657
|
let aclObjectEntry = [];
|
|
683
|
-
const
|
|
658
|
+
const groupedAclEntries = groupBy(aclEntries, (item) => {
|
|
684
659
|
return [item.aclRole.level, item.environmentId, item.objectId];
|
|
685
660
|
});
|
|
686
|
-
forOwn(
|
|
661
|
+
forOwn(groupedAclEntries, (aclEntries, key) => {
|
|
687
662
|
key = key.split(',');
|
|
688
663
|
aclObjectEntry.push({
|
|
689
664
|
object: objects[key[2]],
|
|
690
665
|
level: key[0],
|
|
691
666
|
environmentId: key[1] ? parseInt(key[1]) : null,
|
|
692
667
|
environment: environments[key[1]],
|
|
693
|
-
aclEntries
|
|
668
|
+
aclEntries,
|
|
694
669
|
});
|
|
695
670
|
});
|
|
696
671
|
const hasApp = aclObjectEntry.some((item) => {
|
|
@@ -700,7 +675,8 @@ class FsAclEntriesComponent {
|
|
|
700
675
|
});
|
|
701
676
|
if (!hasApp) {
|
|
702
677
|
aclObjectEntry.unshift({
|
|
703
|
-
object: null,
|
|
678
|
+
object: null,
|
|
679
|
+
aclEntries: [],
|
|
704
680
|
level: 'app',
|
|
705
681
|
environmentId: null,
|
|
706
682
|
});
|
|
@@ -717,7 +693,7 @@ class FsAclEntriesComponent {
|
|
|
717
693
|
}
|
|
718
694
|
update(aclObjectEntry) {
|
|
719
695
|
const data = {
|
|
720
|
-
aclObjectEntry
|
|
696
|
+
aclObjectEntry,
|
|
721
697
|
required: false,
|
|
722
698
|
loadAclRoles: this.loadAclRoles,
|
|
723
699
|
saveAclObjectEntry: this.saveAclObjectEntry
|
|
@@ -740,7 +716,7 @@ class FsAclEntriesComponent {
|
|
|
740
716
|
}
|
|
741
717
|
}
|
|
742
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 });
|
|
743
|
-
FsAclEntriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsAclEntriesComponent, selector: "fs-acl-entries", inputs: { loadAclEntries: "loadAclEntries", loadAclRoles: "loadAclRoles", saveAclObjectEntry: "saveAclObjectEntry", environmentShow: "environmentShow", environmentLabel: "environmentLabel", actions: "actions" }, viewQueries: [{ propertyName: "aclEntriesList", first: true, predicate: FsListComponent, descendants: true }], ngImport: i0, template: "\n<fs-list [config]=\"aclEntriesConfig\">\n <fs-list-column>\n <ng-template fs-list-header>Context</ng-template>\n <ng-template fs-list-cell let-row=\"row\">\n <div\n
|
|
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]" }] });
|
|
744
720
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAclEntriesComponent, decorators: [{
|
|
745
721
|
type: Component,
|
|
746
722
|
args: [{
|