@genesislcap/pbc-auth-ui 1.0.3 → 1.0.4
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/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/profiles/editProfileSchema.d.ts +19 -0
- package/dist/dts/profiles/editProfileSchema.d.ts.map +1 -0
- package/dist/dts/profiles/profiles.d.ts +43 -0
- package/dist/dts/profiles/profiles.d.ts.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/profiles/editProfileSchema.js +40 -0
- package/dist/esm/profiles/profiles.js +86 -0
- package/package.json +1 -1
package/dist/dts/index.d.ts
CHANGED
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const editProfileFormSchema: {
|
|
2
|
+
type: string;
|
|
3
|
+
elements: ({
|
|
4
|
+
type: string;
|
|
5
|
+
label: string;
|
|
6
|
+
scope: string;
|
|
7
|
+
options?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
type: string;
|
|
10
|
+
label: string;
|
|
11
|
+
scope: string;
|
|
12
|
+
options: {
|
|
13
|
+
allOptionsResourceName: string;
|
|
14
|
+
valueField: string;
|
|
15
|
+
labelField: string;
|
|
16
|
+
};
|
|
17
|
+
})[];
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=editProfileSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editProfileSchema.d.ts","sourceRoot":"","sources":["../../../src/profiles/editProfileSchema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;CAuCjC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EntityManagement } from "@genesislcap/foundation-entity-management";
|
|
2
|
+
/**
|
|
3
|
+
* Main class which defined the profile management functionality
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
*
|
|
7
|
+
* Under the hood the profile-management is the entity-management micro-frontend configured for use
|
|
8
|
+
* with the `ALL_PROFILES` resource.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
*
|
|
14
|
+
* You can use this class by forward declaring it in the template file where it is used, and then using
|
|
15
|
+
* it in a html template. It is recommended to wrap it in an error boundary.
|
|
16
|
+
* ```javascript
|
|
17
|
+
* <profile-management></profile-management>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export declare class Profiles extends EntityManagement {
|
|
22
|
+
/**
|
|
23
|
+
* Auth provider which is used to confirm authorisation of the user for their user management permissions
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
*
|
|
27
|
+
* Requires {@link @genesislcap/foundation-comms#Auth | the auth class} to be registered with the
|
|
28
|
+
* DI container
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
private auth;
|
|
32
|
+
/**
|
|
33
|
+
* Constructor will set the {@link EntityManagement.createEvent} {@link EntityManagement.deleteEvent} {@link EntityManagement.updateEvent} to match the permissions set from the server
|
|
34
|
+
*/
|
|
35
|
+
constructor();
|
|
36
|
+
readProfileData(profile: any): Promise<{
|
|
37
|
+
RIGHT_CODES: any[];
|
|
38
|
+
USER_NAMES: any[];
|
|
39
|
+
NAME: any;
|
|
40
|
+
}>;
|
|
41
|
+
confirmDelete(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../../src/profiles/profiles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,gBAAgB,EAAC,MAAM,2CAA2C,CAAC;AAE3E;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAGa,QAAS,SAAQ,gBAAgB;IAC5C;;;;;;;;OAQG;IACG,OAAO,CAAC,IAAI,CAAO;IAEzB;;OAEG;;IAuBU,eAAe,CAAC,OAAO,KAAA;;;;;IAsBrB,aAAa;CAM7B"}
|
package/dist/esm/index.js
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const editProfileFormSchema = {
|
|
2
|
+
type: 'VerticalLayout',
|
|
3
|
+
elements: [
|
|
4
|
+
{
|
|
5
|
+
type: 'Control',
|
|
6
|
+
label: 'Name',
|
|
7
|
+
scope: '#/properties/NAME',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
type: 'Control',
|
|
11
|
+
label: 'Description',
|
|
12
|
+
scope: '#/properties/DESCRIPTION',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: 'Control',
|
|
16
|
+
label: 'Status',
|
|
17
|
+
scope: '#/properties/STATUS',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'Control',
|
|
21
|
+
label: 'Rights',
|
|
22
|
+
scope: '#/properties/RIGHT_CODES',
|
|
23
|
+
options: {
|
|
24
|
+
allOptionsResourceName: 'RIGHT',
|
|
25
|
+
valueField: 'CODE',
|
|
26
|
+
labelField: 'CODE',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: 'Control',
|
|
31
|
+
label: 'Users',
|
|
32
|
+
scope: '#/properties/USER_NAMES',
|
|
33
|
+
options: {
|
|
34
|
+
allOptionsResourceName: 'USER',
|
|
35
|
+
valueField: 'USER_NAME',
|
|
36
|
+
labelField: 'USER_NAME',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
|
+
import { Auth } from '@genesislcap/foundation-comms';
|
|
3
|
+
import { customElement } from '@microsoft/fast-element';
|
|
4
|
+
import { editProfileFormSchema } from './editProfileSchema';
|
|
5
|
+
import { EntityManagement } from "@genesislcap/foundation-entity-management";
|
|
6
|
+
/**
|
|
7
|
+
* Main class which defined the profile management functionality
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
*
|
|
11
|
+
* Under the hood the profile-management is the entity-management micro-frontend configured for use
|
|
12
|
+
* with the `ALL_PROFILES` resource.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
*
|
|
18
|
+
* You can use this class by forward declaring it in the template file where it is used, and then using
|
|
19
|
+
* it in a html template. It is recommended to wrap it in an error boundary.
|
|
20
|
+
* ```javascript
|
|
21
|
+
* <profile-management></profile-management>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
let Profiles = class Profiles extends EntityManagement {
|
|
26
|
+
/**
|
|
27
|
+
* Constructor will set the {@link EntityManagement.createEvent} {@link EntityManagement.deleteEvent} {@link EntityManagement.updateEvent} to match the permissions set from the server
|
|
28
|
+
*/
|
|
29
|
+
constructor() {
|
|
30
|
+
super();
|
|
31
|
+
this.createEvent = this.auth.currentUser.hasPermission('INSERT_PROFILE')
|
|
32
|
+
? 'EVENT_INSERT_PROFILE'
|
|
33
|
+
: '';
|
|
34
|
+
this.deleteEvent = this.auth.currentUser.hasPermission('DELETE_PROFILE')
|
|
35
|
+
? 'EVENT_DELETE_PROFILE'
|
|
36
|
+
: '';
|
|
37
|
+
this.updateEvent = this.auth.currentUser.hasPermission('AMEND_PROFILE')
|
|
38
|
+
? 'EVENT_AMEND_PROFILE'
|
|
39
|
+
: '';
|
|
40
|
+
this.persistColumnStateKey = 'entity_profiles_management';
|
|
41
|
+
this.updateFormUiSchema = editProfileFormSchema;
|
|
42
|
+
this.createFormUiSchema = editProfileFormSchema;
|
|
43
|
+
this.readEventFn = this.readProfileData.bind(this);
|
|
44
|
+
this.resourceName = 'ALL_PROFILES';
|
|
45
|
+
this.title = 'Profile Management';
|
|
46
|
+
this.entityLabel = 'Profile';
|
|
47
|
+
}
|
|
48
|
+
readProfileData(profile) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const selectedRightsReq = yield this.connect.request('PROFILE_RIGHT', {
|
|
51
|
+
REQUEST: {
|
|
52
|
+
PROFILE_NAME: profile.PROFILE_NAME,
|
|
53
|
+
RIGHT_CODE: '*',
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
const selectedUsersReq = yield this.connect.request('PROFILE_USER', {
|
|
57
|
+
REQUEST: {
|
|
58
|
+
PROFILE_NAME: profile.PROFILE_NAME,
|
|
59
|
+
USER_NAME: '*',
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
return {
|
|
63
|
+
RIGHT_CODES: selectedRightsReq.REPLY.map((v) => v.RIGHT_CODE),
|
|
64
|
+
USER_NAMES: Array.from(new Set(selectedUsersReq.REPLY.map((v) => v.USER_NAME))),
|
|
65
|
+
NAME: profile.PROFILE_NAME,
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
confirmDelete() {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const deleteReq = yield this.connect.commitEvent(this.deleteEvent, {
|
|
72
|
+
DETAILS: { NAME: this.selectedEntity.PROFILE_NAME },
|
|
73
|
+
});
|
|
74
|
+
this.errorNotify(deleteReq);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
__decorate([
|
|
79
|
+
Auth
|
|
80
|
+
], Profiles.prototype, "auth", void 0);
|
|
81
|
+
Profiles = __decorate([
|
|
82
|
+
customElement({
|
|
83
|
+
name: 'profile-management',
|
|
84
|
+
})
|
|
85
|
+
], Profiles);
|
|
86
|
+
export { Profiles };
|
package/package.json
CHANGED