@things-factory/auth-base 9.0.0-beta.76 → 9.0.0
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-client/auth.js +2 -4
- package/dist-client/auth.js.map +1 -1
- package/dist-client/reducers/auth.js +9 -2
- package/dist-client/reducers/auth.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/change-pwd.js +5 -2
- package/dist-server/controllers/change-pwd.js.map +1 -1
- package/dist-server/controllers/checkin.js +1 -1
- package/dist-server/controllers/checkin.js.map +1 -1
- package/dist-server/controllers/delete-user.js +2 -2
- package/dist-server/controllers/delete-user.js.map +1 -1
- package/dist-server/controllers/profile.js +4 -1
- package/dist-server/controllers/profile.js.map +1 -1
- package/dist-server/controllers/reset-password.js +5 -2
- package/dist-server/controllers/reset-password.js.map +1 -1
- package/dist-server/controllers/signin.js +2 -2
- package/dist-server/controllers/signin.js.map +1 -1
- package/dist-server/controllers/signup.js +8 -1
- package/dist-server/controllers/signup.js.map +1 -1
- package/dist-server/errors/auth-error.js +3 -1
- package/dist-server/errors/auth-error.js.map +1 -1
- package/dist-server/middlewares/authenticate-401-middleware.js +22 -9
- package/dist-server/middlewares/authenticate-401-middleware.js.map +1 -1
- package/dist-server/middlewares/domain-authenticate-middleware.js +1 -1
- package/dist-server/middlewares/domain-authenticate-middleware.js.map +1 -1
- package/dist-server/middlewares/jwt-authenticate-middleware.js +1 -1
- package/dist-server/middlewares/jwt-authenticate-middleware.js.map +1 -1
- package/dist-server/migrations/1548206416130-SeedUser.js +11 -3
- package/dist-server/migrations/1548206416130-SeedUser.js.map +1 -1
- package/dist-server/router/auth-signup-router.js +5 -2
- package/dist-server/router/auth-signup-router.js.map +1 -1
- package/dist-server/router/oauth2/oauth2-authorize-router.js +5 -2
- package/dist-server/router/oauth2/oauth2-authorize-router.js.map +1 -1
- package/dist-server/router/oauth2/oauth2-router.js +1 -2
- package/dist-server/router/oauth2/oauth2-router.js.map +1 -1
- package/dist-server/router/oauth2/oauth2-server.js +21 -3
- package/dist-server/router/oauth2/oauth2-server.js.map +1 -1
- package/dist-server/router/site-root-router.js +1 -1
- package/dist-server/router/site-root-router.js.map +1 -1
- package/dist-server/router/webauthn-router.js +1 -1
- package/dist-server/router/webauthn-router.js.map +1 -1
- package/dist-server/service/app-binding/app-binding-types.js +3 -3
- package/dist-server/service/app-binding/app-binding-types.js.map +1 -1
- package/dist-server/service/app-binding/app-binding.js +6 -4
- package/dist-server/service/app-binding/app-binding.js.map +1 -1
- package/dist-server/service/appliance/appliance-mutation.js +20 -4
- package/dist-server/service/appliance/appliance-mutation.js.map +1 -1
- package/dist-server/service/appliance/appliance-types.js +18 -18
- package/dist-server/service/appliance/appliance-types.js.map +1 -1
- package/dist-server/service/appliance/appliance.js +22 -18
- package/dist-server/service/appliance/appliance.js.map +1 -1
- package/dist-server/service/application/application-mutation.js +22 -4
- package/dist-server/service/application/application-mutation.js.map +1 -1
- package/dist-server/service/application/application-types.js +24 -24
- package/dist-server/service/application/application-types.js.map +1 -1
- package/dist-server/service/application/application.d.ts +6 -6
- package/dist-server/service/application/application.js +22 -22
- package/dist-server/service/application/application.js.map +1 -1
- package/dist-server/service/auth-provider/auth-provider-mutation.js +29 -7
- package/dist-server/service/auth-provider/auth-provider-mutation.js.map +1 -1
- package/dist-server/service/auth-provider/auth-provider-parameter-spec.js +12 -7
- package/dist-server/service/auth-provider/auth-provider-parameter-spec.js.map +1 -1
- package/dist-server/service/auth-provider/auth-provider-type.js +24 -21
- package/dist-server/service/auth-provider/auth-provider-type.js.map +1 -1
- package/dist-server/service/auth-provider/auth-provider.js +35 -25
- package/dist-server/service/auth-provider/auth-provider.js.map +1 -1
- package/dist-server/service/domain-generator/domain-generator-mutation.js +1 -2
- package/dist-server/service/domain-generator/domain-generator-mutation.js.map +1 -1
- package/dist-server/service/domain-generator/domain-generator-types.js +17 -14
- package/dist-server/service/domain-generator/domain-generator-types.js.map +1 -1
- package/dist-server/service/domain-link/domain-link-mutation.js +23 -6
- package/dist-server/service/domain-link/domain-link-mutation.js.map +1 -1
- package/dist-server/service/domain-link/domain-link-types.js +13 -13
- package/dist-server/service/domain-link/domain-link-types.js.map +1 -1
- package/dist-server/service/domain-link/domain-link.d.ts +2 -2
- package/dist-server/service/domain-link/domain-link.js +11 -11
- package/dist-server/service/domain-link/domain-link.js.map +1 -1
- package/dist-server/service/granted-role/granted-role-mutation.js +7 -7
- package/dist-server/service/granted-role/granted-role-mutation.js.map +1 -1
- package/dist-server/service/granted-role/granted-role.js +4 -4
- package/dist-server/service/granted-role/granted-role.js.map +1 -1
- package/dist-server/service/invitation/invitation-mutation.js +6 -2
- package/dist-server/service/invitation/invitation-mutation.js.map +1 -1
- package/dist-server/service/invitation/invitation-types.js +3 -3
- package/dist-server/service/invitation/invitation-types.js.map +1 -1
- package/dist-server/service/invitation/invitation.js +10 -10
- package/dist-server/service/invitation/invitation.js.map +1 -1
- package/dist-server/service/login-history/login-history-type.js +3 -3
- package/dist-server/service/login-history/login-history-type.js.map +1 -1
- package/dist-server/service/login-history/login-history.js +6 -6
- package/dist-server/service/login-history/login-history.js.map +1 -1
- package/dist-server/service/partner/partner-types.js +3 -3
- package/dist-server/service/partner/partner-types.js.map +1 -1
- package/dist-server/service/partner/partner.js +8 -8
- package/dist-server/service/partner/partner.js.map +1 -1
- package/dist-server/service/password-history/password-history.js +3 -3
- package/dist-server/service/password-history/password-history.js.map +1 -1
- package/dist-server/service/privilege/privilege-directive.js +1 -2
- package/dist-server/service/privilege/privilege-directive.js.map +1 -1
- package/dist-server/service/privilege/privilege-mutation.js +11 -2
- package/dist-server/service/privilege/privilege-mutation.js.map +1 -1
- package/dist-server/service/privilege/privilege.js +20 -20
- package/dist-server/service/privilege/privilege.js.map +1 -1
- package/dist-server/service/role/role-mutation.js +12 -2
- package/dist-server/service/role/role-mutation.js.map +1 -1
- package/dist-server/service/role/role-query.js +1 -1
- package/dist-server/service/role/role-query.js.map +1 -1
- package/dist-server/service/role/role-types.js +29 -29
- package/dist-server/service/role/role-types.js.map +1 -1
- package/dist-server/service/role/role.js +11 -11
- package/dist-server/service/role/role.js.map +1 -1
- package/dist-server/service/user/user-mutation.js +89 -41
- package/dist-server/service/user/user-mutation.js.map +1 -1
- package/dist-server/service/user/user-query.js +16 -10
- package/dist-server/service/user/user-query.js.map +1 -1
- package/dist-server/service/user/user-types.js +33 -32
- package/dist-server/service/user/user-types.js.map +1 -1
- package/dist-server/service/user/user.d.ts +5 -5
- package/dist-server/service/user/user.js +25 -22
- package/dist-server/service/user/user.js.map +1 -1
- package/dist-server/service/users-auth-providers/users-auth-providers.js +11 -8
- package/dist-server/service/users-auth-providers/users-auth-providers.js.map +1 -1
- package/dist-server/service/verification-token/verification-token.d.ts +3 -3
- package/dist-server/service/verification-token/verification-token.js +8 -8
- package/dist-server/service/verification-token/verification-token.js.map +1 -1
- package/dist-server/service/web-auth-credential/web-auth-credential.js +11 -10
- package/dist-server/service/web-auth-credential/web-auth-credential.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/dist-server/utils/access-token-cookie.js +1 -2
- package/dist-server/utils/access-token-cookie.js.map +1 -1
- package/dist-server/utils/check-user-belongs-domain.js +1 -2
- package/dist-server/utils/check-user-belongs-domain.js.map +1 -1
- package/dist-server/utils/get-domain-users.js +2 -2
- package/dist-server/utils/get-domain-users.js.map +1 -1
- package/package.json +6 -6
@@ -9,128 +9,128 @@ let NewRole = class NewRole {
|
|
9
9
|
};
|
10
10
|
exports.NewRole = NewRole;
|
11
11
|
tslib_1.__decorate([
|
12
|
-
(0, type_graphql_1.Field)(),
|
12
|
+
(0, type_graphql_1.Field)({ description: 'The name of the new role.' }),
|
13
13
|
tslib_1.__metadata("design:type", String)
|
14
14
|
], NewRole.prototype, "name", void 0);
|
15
15
|
tslib_1.__decorate([
|
16
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
16
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A description for the new role.' }),
|
17
17
|
tslib_1.__metadata("design:type", String)
|
18
18
|
], NewRole.prototype, "description", void 0);
|
19
19
|
tslib_1.__decorate([
|
20
|
-
(0, type_graphql_1.Field)(type => [shell_1.ObjectRef], { nullable: true }),
|
20
|
+
(0, type_graphql_1.Field)(type => [shell_1.ObjectRef], { nullable: true, description: 'Users to be assigned to the new role.' }),
|
21
21
|
tslib_1.__metadata("design:type", Array)
|
22
22
|
], NewRole.prototype, "users", void 0);
|
23
23
|
tslib_1.__decorate([
|
24
|
-
(0, type_graphql_1.Field)(type => [shell_1.ObjectRef], { nullable: true }),
|
24
|
+
(0, type_graphql_1.Field)(type => [shell_1.ObjectRef], { nullable: true, description: 'Privileges to be granted by the new role.' }),
|
25
25
|
tslib_1.__metadata("design:type", Array)
|
26
26
|
], NewRole.prototype, "privileges", void 0);
|
27
27
|
exports.NewRole = NewRole = tslib_1.__decorate([
|
28
|
-
(0, type_graphql_1.InputType)()
|
28
|
+
(0, type_graphql_1.InputType)({ description: 'Input for creating a new role.' })
|
29
29
|
], NewRole);
|
30
30
|
let RolePatch = class RolePatch {
|
31
31
|
};
|
32
32
|
exports.RolePatch = RolePatch;
|
33
33
|
tslib_1.__decorate([
|
34
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
34
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The unique identifier of the role to update.' }),
|
35
35
|
tslib_1.__metadata("design:type", String)
|
36
36
|
], RolePatch.prototype, "id", void 0);
|
37
37
|
tslib_1.__decorate([
|
38
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
38
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new name for the role.' }),
|
39
39
|
tslib_1.__metadata("design:type", String)
|
40
40
|
], RolePatch.prototype, "name", void 0);
|
41
41
|
tslib_1.__decorate([
|
42
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
42
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new description for the role.' }),
|
43
43
|
tslib_1.__metadata("design:type", String)
|
44
44
|
], RolePatch.prototype, "description", void 0);
|
45
45
|
tslib_1.__decorate([
|
46
|
-
(0, type_graphql_1.Field)(type => [shell_1.ObjectRef], { nullable: true }),
|
46
|
+
(0, type_graphql_1.Field)(type => [shell_1.ObjectRef], { nullable: true, description: 'A new list of users to be assigned to the role.' }),
|
47
47
|
tslib_1.__metadata("design:type", Array)
|
48
48
|
], RolePatch.prototype, "users", void 0);
|
49
49
|
tslib_1.__decorate([
|
50
|
-
(0, type_graphql_1.Field)(type => [shell_1.ObjectRef], { nullable: true }),
|
50
|
+
(0, type_graphql_1.Field)(type => [shell_1.ObjectRef], { nullable: true, description: 'A new list of privileges to be granted by the role.' }),
|
51
51
|
tslib_1.__metadata("design:type", Array)
|
52
52
|
], RolePatch.prototype, "privileges", void 0);
|
53
53
|
tslib_1.__decorate([
|
54
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
54
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A flag indicating whether the role is being created, updated, or deleted.' }),
|
55
55
|
tslib_1.__metadata("design:type", String)
|
56
56
|
], RolePatch.prototype, "cuFlag", void 0);
|
57
57
|
exports.RolePatch = RolePatch = tslib_1.__decorate([
|
58
|
-
(0, type_graphql_1.InputType)()
|
58
|
+
(0, type_graphql_1.InputType)({ description: 'Input for updating (patching) an existing role.' })
|
59
59
|
], RolePatch);
|
60
60
|
let RoleList = class RoleList {
|
61
61
|
};
|
62
62
|
exports.RoleList = RoleList;
|
63
63
|
tslib_1.__decorate([
|
64
|
-
(0, type_graphql_1.Field)(type => [role_js_1.Role], { nullable: true }),
|
64
|
+
(0, type_graphql_1.Field)(type => [role_js_1.Role], { nullable: true, description: 'The list of role items.' }),
|
65
65
|
tslib_1.__metadata("design:type", Array)
|
66
66
|
], RoleList.prototype, "items", void 0);
|
67
67
|
tslib_1.__decorate([
|
68
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
68
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'The total number of roles.' }),
|
69
69
|
tslib_1.__metadata("design:type", Number)
|
70
70
|
], RoleList.prototype, "total", void 0);
|
71
71
|
exports.RoleList = RoleList = tslib_1.__decorate([
|
72
|
-
(0, type_graphql_1.ObjectType)()
|
72
|
+
(0, type_graphql_1.ObjectType)({ description: 'A paginated list of roles.' })
|
73
73
|
], RoleList);
|
74
74
|
let RoleBrief = class RoleBrief {
|
75
75
|
};
|
76
76
|
exports.RoleBrief = RoleBrief;
|
77
77
|
tslib_1.__decorate([
|
78
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
78
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The unique identifier of the role.' }),
|
79
79
|
tslib_1.__metadata("design:type", String)
|
80
80
|
], RoleBrief.prototype, "id", void 0);
|
81
81
|
tslib_1.__decorate([
|
82
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
82
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The name of the role.' }),
|
83
83
|
tslib_1.__metadata("design:type", String)
|
84
84
|
], RoleBrief.prototype, "name", void 0);
|
85
85
|
exports.RoleBrief = RoleBrief = tslib_1.__decorate([
|
86
|
-
(0, type_graphql_1.ObjectType)()
|
86
|
+
(0, type_graphql_1.ObjectType)({ description: 'A brief summary of a role, containing only the ID and name.' })
|
87
87
|
], RoleBrief);
|
88
88
|
let RolePrivilege = class RolePrivilege {
|
89
89
|
};
|
90
90
|
exports.RolePrivilege = RolePrivilege;
|
91
91
|
tslib_1.__decorate([
|
92
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
92
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The unique identifier of the privilege.' }),
|
93
93
|
tslib_1.__metadata("design:type", String)
|
94
94
|
], RolePrivilege.prototype, "id", void 0);
|
95
95
|
tslib_1.__decorate([
|
96
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
96
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The name of the privilege.' }),
|
97
97
|
tslib_1.__metadata("design:type", String)
|
98
98
|
], RolePrivilege.prototype, "name", void 0);
|
99
99
|
tslib_1.__decorate([
|
100
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
100
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The category of the privilege.' }),
|
101
101
|
tslib_1.__metadata("design:type", String)
|
102
102
|
], RolePrivilege.prototype, "category", void 0);
|
103
103
|
tslib_1.__decorate([
|
104
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
104
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A description of the privilege.' }),
|
105
105
|
tslib_1.__metadata("design:type", String)
|
106
106
|
], RolePrivilege.prototype, "description", void 0);
|
107
107
|
tslib_1.__decorate([
|
108
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
108
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Indicates whether the privilege is assigned to the role.' }),
|
109
109
|
tslib_1.__metadata("design:type", Boolean)
|
110
110
|
], RolePrivilege.prototype, "assigned", void 0);
|
111
111
|
exports.RolePrivilege = RolePrivilege = tslib_1.__decorate([
|
112
|
-
(0, type_graphql_1.ObjectType)()
|
112
|
+
(0, type_graphql_1.ObjectType)({ description: 'Represents a privilege and whether it is assigned to a specific role.' })
|
113
113
|
], RolePrivilege);
|
114
114
|
let UserRole = class UserRole {
|
115
115
|
};
|
116
116
|
exports.UserRole = UserRole;
|
117
117
|
tslib_1.__decorate([
|
118
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
118
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The unique identifier of the role.' }),
|
119
119
|
tslib_1.__metadata("design:type", String)
|
120
120
|
], UserRole.prototype, "id", void 0);
|
121
121
|
tslib_1.__decorate([
|
122
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
122
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The name of the role.' }),
|
123
123
|
tslib_1.__metadata("design:type", String)
|
124
124
|
], UserRole.prototype, "name", void 0);
|
125
125
|
tslib_1.__decorate([
|
126
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
126
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A description of the role.' }),
|
127
127
|
tslib_1.__metadata("design:type", String)
|
128
128
|
], UserRole.prototype, "description", void 0);
|
129
129
|
tslib_1.__decorate([
|
130
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
130
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Indicates whether the role is assigned to the user.' }),
|
131
131
|
tslib_1.__metadata("design:type", Boolean)
|
132
132
|
], UserRole.prototype, "assigned", void 0);
|
133
133
|
exports.UserRole = UserRole = tslib_1.__decorate([
|
134
|
-
(0, type_graphql_1.ObjectType)()
|
134
|
+
(0, type_graphql_1.ObjectType)({ description: 'Represents a role and whether it is assigned to a specific user.' })
|
135
135
|
], UserRole);
|
136
136
|
//# sourceMappingURL=role-types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"role-types.js","sourceRoot":"","sources":["../../../server/service/role/role-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,iDAAiD;AACjD,uCAAgC;AAGzB,IAAM,OAAO,GAAb,MAAM,OAAO;CAYnB,CAAA;AAZY,0BAAO;AAElB;IADC,IAAA,oBAAK,
|
1
|
+
{"version":3,"file":"role-types.js","sourceRoot":"","sources":["../../../server/service/role/role-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,iDAAiD;AACjD,uCAAgC;AAGzB,IAAM,OAAO,GAAb,MAAM,OAAO;CAYnB,CAAA;AAZY,0BAAO;AAElB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;;qCACxC;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;;4CACtD;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,iBAAS,CAAC,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AAW,EAAE,iCAAiC,EAAE,CAAC;;kDACtD;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,0DAA0D,EAAE,CAAC;;+CACjF;wBAdP,aAAa;IADzB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,uEAAuE,EAAE,CAAC;GACxF,aAAa,CAezB;AAGM,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAYpB,CAAA;AAZY,4BAAQ;AAEnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC;;oCAClE;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;;sCACnD;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;;6CACjD;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,qDAAqD,EAAE,CAAC;;0CAC5E;mBAXP,QAAQ;IADpB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,kEAAkE,EAAE,CAAC;GACnF,QAAQ,CAYpB","sourcesContent":["import { ObjectType, InputType, Field, Int } from 'type-graphql'\nimport { ObjectRef } from '@things-factory/shell'\nimport { Role } from './role.js'\n\n@InputType({ description: 'Input for creating a new role.' })\nexport class NewRole {\n @Field({ description: 'The name of the new role.' })\n name: string\n\n @Field({ nullable: true, description: 'A description for the new role.' })\n description?: string\n\n @Field(type => [ObjectRef], { nullable: true, description: 'Users to be assigned to the new role.' })\n users?: ObjectRef[]\n\n @Field(type => [ObjectRef], { nullable: true, description: 'Privileges to be granted by the new role.' })\n privileges?: ObjectRef[]\n}\n\n@InputType({ description: 'Input for updating (patching) an existing role.' })\nexport class RolePatch {\n @Field({ nullable: true, description: 'The unique identifier of the role to update.' })\n id?: string\n\n @Field({ nullable: true, description: 'The new name for the role.' })\n name?: string\n\n @Field({ nullable: true, description: 'The new description for the role.' })\n description?: string\n\n @Field(type => [ObjectRef], { nullable: true, description: 'A new list of users to be assigned to the role.' })\n users?: ObjectRef[]\n\n @Field(type => [ObjectRef], { nullable: true, description: 'A new list of privileges to be granted by the role.' })\n privileges?: ObjectRef[]\n\n @Field({ nullable: true, description: 'A flag indicating whether the role is being created, updated, or deleted.' })\n cuFlag?: string\n}\n\n@ObjectType({ description: 'A paginated list of roles.' })\nexport class RoleList {\n @Field(type => [Role], { nullable: true, description: 'The list of role items.' })\n items?: Role[]\n\n @Field(type => Int, { nullable: true, description: 'The total number of roles.' })\n total?: number\n}\n\n@ObjectType({ description: 'A brief summary of a role, containing only the ID and name.' })\nexport class RoleBrief {\n @Field({ nullable: true, description: 'The unique identifier of the role.' })\n id?: string\n\n @Field({ nullable: true, description: 'The name of the role.' })\n name?: string\n}\n\n@ObjectType({ description: 'Represents a privilege and whether it is assigned to a specific role.' })\nexport class RolePrivilege {\n @Field({ nullable: true, description: 'The unique identifier of the privilege.' })\n id?: string\n\n @Field({ nullable: true, description: 'The name of the privilege.' })\n name?: string\n\n @Field({ nullable: true, description: 'The category of the privilege.' })\n category?: string\n\n @Field({ nullable: true, description: 'A description of the privilege.' })\n description?: string\n\n @Field({ nullable: true, description: 'Indicates whether the privilege is assigned to the role.' })\n assigned?: boolean\n}\n\n@ObjectType({ description: 'Represents a role and whether it is assigned to a specific user.' })\nexport class UserRole {\n @Field({ nullable: true, description: 'The unique identifier of the role.' })\n id?: string\n\n @Field({ nullable: true, description: 'The name of the role.' })\n name?: string\n\n @Field({ nullable: true, description: 'A description of the role.' })\n description?: string\n\n @Field({ nullable: true, description: 'Indicates whether the role is assigned to the user.' })\n assigned?: boolean\n}\n"]}
|
@@ -12,12 +12,12 @@ let Role = class Role {
|
|
12
12
|
exports.Role = Role;
|
13
13
|
tslib_1.__decorate([
|
14
14
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
15
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
15
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the role.' }),
|
16
16
|
tslib_1.__metadata("design:type", String)
|
17
17
|
], Role.prototype, "id", void 0);
|
18
18
|
tslib_1.__decorate([
|
19
19
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
20
|
-
(0, type_graphql_1.Field)(type => shell_1.Domain),
|
20
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { description: 'The domain to which the role belongs.' }),
|
21
21
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
22
22
|
], Role.prototype, "domain", void 0);
|
23
23
|
tslib_1.__decorate([
|
@@ -26,29 +26,29 @@ tslib_1.__decorate([
|
|
26
26
|
], Role.prototype, "domainId", void 0);
|
27
27
|
tslib_1.__decorate([
|
28
28
|
(0, typeorm_1.Column)(),
|
29
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
29
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The name of the role.' }),
|
30
30
|
tslib_1.__metadata("design:type", String)
|
31
31
|
], Role.prototype, "name", void 0);
|
32
32
|
tslib_1.__decorate([
|
33
33
|
(0, typeorm_1.ManyToMany)(type => user_js_1.User, user => user.roles),
|
34
|
-
(0, type_graphql_1.Field)(type => [user_js_1.User], { nullable: true }),
|
34
|
+
(0, type_graphql_1.Field)(type => [user_js_1.User], { nullable: true, description: 'Users who are assigned this role.' }),
|
35
35
|
tslib_1.__metadata("design:type", Array)
|
36
36
|
], Role.prototype, "users", void 0);
|
37
37
|
tslib_1.__decorate([
|
38
38
|
(0, typeorm_1.ManyToMany)(type => privilege_js_1.Privilege, privilege => privilege.roles),
|
39
|
-
(0, type_graphql_1.Field)(type => [privilege_js_1.Privilege], { nullable: true }),
|
39
|
+
(0, type_graphql_1.Field)(type => [privilege_js_1.Privilege], { nullable: true, description: 'Privileges granted by this role.' }),
|
40
40
|
tslib_1.__metadata("design:type", Array)
|
41
41
|
], Role.prototype, "privileges", void 0);
|
42
42
|
tslib_1.__decorate([
|
43
43
|
(0, typeorm_1.Column)({
|
44
44
|
nullable: true
|
45
45
|
}),
|
46
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
46
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A description of the role.' }),
|
47
47
|
tslib_1.__metadata("design:type", String)
|
48
48
|
], Role.prototype, "description", void 0);
|
49
49
|
tslib_1.__decorate([
|
50
50
|
(0, typeorm_1.ManyToOne)(type => user_js_1.User, { nullable: true }),
|
51
|
-
(0, type_graphql_1.Field)(type => user_js_1.User, { nullable: true }),
|
51
|
+
(0, type_graphql_1.Field)(type => user_js_1.User, { nullable: true, description: 'The user who created the role.' }),
|
52
52
|
tslib_1.__metadata("design:type", user_js_1.User)
|
53
53
|
], Role.prototype, "creator", void 0);
|
54
54
|
tslib_1.__decorate([
|
@@ -57,7 +57,7 @@ tslib_1.__decorate([
|
|
57
57
|
], Role.prototype, "creatorId", void 0);
|
58
58
|
tslib_1.__decorate([
|
59
59
|
(0, typeorm_1.ManyToOne)(type => user_js_1.User, { nullable: true }),
|
60
|
-
(0, type_graphql_1.Field)(type => user_js_1.User, { nullable: true }),
|
60
|
+
(0, type_graphql_1.Field)(type => user_js_1.User, { nullable: true, description: 'The user who last updated the role.' }),
|
61
61
|
tslib_1.__metadata("design:type", user_js_1.User)
|
62
62
|
], Role.prototype, "updater", void 0);
|
63
63
|
tslib_1.__decorate([
|
@@ -66,17 +66,17 @@ tslib_1.__decorate([
|
|
66
66
|
], Role.prototype, "updaterId", void 0);
|
67
67
|
tslib_1.__decorate([
|
68
68
|
(0, typeorm_1.CreateDateColumn)(),
|
69
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
69
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the role was created.' }),
|
70
70
|
tslib_1.__metadata("design:type", Date)
|
71
71
|
], Role.prototype, "createdAt", void 0);
|
72
72
|
tslib_1.__decorate([
|
73
73
|
(0, typeorm_1.UpdateDateColumn)(),
|
74
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
74
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the role was last updated.' }),
|
75
75
|
tslib_1.__metadata("design:type", Date)
|
76
76
|
], Role.prototype, "updatedAt", void 0);
|
77
77
|
exports.Role = Role = tslib_1.__decorate([
|
78
78
|
(0, typeorm_1.Entity)(),
|
79
79
|
(0, typeorm_1.Index)('ix_role_0', (role) => [role.name, role.domain], { unique: true }),
|
80
|
-
(0, type_graphql_1.ObjectType)()
|
80
|
+
(0, type_graphql_1.ObjectType)({ description: 'A role that groups a set of privileges, which can be assigned to users.' })
|
81
81
|
], Role);
|
82
82
|
//# sourceMappingURL=role.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"role.js","sourceRoot":"","sources":["../../../server/service/role/role.ts"],"names":[],"mappings":";;;;AAAA,iDAA8C;AAC9C,qCAWgB;AAChB,+CAAoD;AACpD,4DAAqD;AACrD,6CAAsC;AAK/B,IAAM,IAAI,GAAV,MAAM,IAAI;CAmDhB,CAAA;AAnDY,oBAAI;AAGN;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;
|
1
|
+
{"version":3,"file":"role.js","sourceRoot":"","sources":["../../../server/service/role/role.ts"],"names":[],"mappings":";;;;AAAA,iDAA8C;AAC9C,qCAWgB;AAChB,+CAAoD;AACpD,4DAAqD;AACrD,6CAAsC;AAK/B,IAAM,IAAI,GAAV,MAAM,IAAI;CAmDhB,CAAA;AAnDY,oBAAI;AAGN;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;;gCACnD;AAInB;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RelationId,\n PrimaryGeneratedColumn,\n UpdateDateColumn\n} from 'typeorm'\nimport { ObjectType, Field, ID } from 'type-graphql'\nimport { Privilege } from '../privilege/privilege.js'\nimport { User } from '../user/user.js'\n\n@Entity()\n@Index('ix_role_0', (role: Role) => [role.name, role.domain], { unique: true })\n@ObjectType({ description: 'A role that groups a set of privileges, which can be assigned to users.' })\nexport class Role {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the role.' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { description: 'The domain to which the role belongs.' })\n domain?: Domain\n\n @RelationId((role: Role) => role.domain)\n domainId: string\n\n @Column()\n @Field({ nullable: true, description: 'The name of the role.' })\n name: string\n\n @ManyToMany(type => User, user => user.roles)\n @Field(type => [User], { nullable: true, description: 'Users who are assigned this role.' })\n users: User[]\n\n @ManyToMany(type => Privilege, privilege => privilege.roles)\n @Field(type => [Privilege], { nullable: true, description: 'Privileges granted by this role.' })\n privileges: Privilege[]\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true, description: 'A description of the role.' })\n description: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created the role.' })\n creator: User\n\n @RelationId((role: Role) => role.creator)\n creatorId: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated the role.' })\n updater: User\n\n @RelationId((role: Role) => role.updater)\n updaterId: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the role was created.' })\n createdAt: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the role was last updated.' })\n updatedAt: Date\n}\n"]}
|
@@ -38,18 +38,27 @@ let UserMutation = class UserMutation {
|
|
38
38
|
/* check if password is following the rule */
|
39
39
|
// User.validatePasswordByRule(user.password, context.lng)
|
40
40
|
const salt = user_js_1.User.generateSalt();
|
41
|
-
return await userRepository.save(
|
41
|
+
return await userRepository.save({
|
42
|
+
creator: context.state.user,
|
43
|
+
updater: context.state.user,
|
44
|
+
...user,
|
45
|
+
domains: [domain],
|
46
|
+
roles: user.roles && user.roles.length
|
42
47
|
? await (0, shell_1.getRepository)(role_js_1.Role, tx).findBy({
|
43
48
|
id: (0, typeorm_1.In)(user.roles.map(role => role.id)),
|
44
49
|
domain: { id: domain.id }
|
45
50
|
})
|
46
|
-
: [],
|
51
|
+
: [],
|
52
|
+
salt,
|
53
|
+
passwordUpdatedAt: new Date(),
|
54
|
+
password: user.password ? user_js_1.User.encode(user.password, salt) : user_js_1.User.encode(defaultPassword, salt)
|
55
|
+
});
|
47
56
|
}
|
48
57
|
async updateUser(email, patch, context) {
|
49
58
|
const { domain, user: updater, tx } = context.state;
|
50
59
|
const qb = (0, get_domain_users_js_1.buildDomainUsersQueryBuilder)(domain.id, 'USER');
|
51
60
|
const user = await qb
|
52
|
-
.andWhere('LOWER(USER.email) = :email', { email:
|
61
|
+
.andWhere('LOWER(USER.email) = :email', { email: email?.toLowerCase().trim() || '' })
|
53
62
|
.leftJoinAndSelect('USER.roles', 'ROLES')
|
54
63
|
.leftJoinAndSelect('ROLES.domain', 'R_DOMAIN')
|
55
64
|
.getOne();
|
@@ -61,7 +70,11 @@ let UserMutation = class UserMutation {
|
|
61
70
|
if (patch.status && patch.status === 'activated') {
|
62
71
|
user.status = user_js_1.UserStatus.ACTIVATED;
|
63
72
|
}
|
64
|
-
return await (0, shell_1.getRepository)(user_js_1.User, tx).save(
|
73
|
+
return await (0, shell_1.getRepository)(user_js_1.User, tx).save({
|
74
|
+
...user,
|
75
|
+
...patch,
|
76
|
+
updater
|
77
|
+
});
|
65
78
|
}
|
66
79
|
async updateMultipleUser(patches, context) {
|
67
80
|
const { domain, user, tx } = context.state;
|
@@ -76,7 +89,15 @@ let UserMutation = class UserMutation {
|
|
76
89
|
/* check if password is following the rule */
|
77
90
|
// User.validatePasswordByRule(newRecord.password, context.lng)
|
78
91
|
const salt = user_js_1.User.generateSalt();
|
79
|
-
const result = await userRepo.save(
|
92
|
+
const result = await userRepo.save({
|
93
|
+
...newRecord,
|
94
|
+
domains: [domain],
|
95
|
+
salt,
|
96
|
+
password: user_js_1.User.encode(newRecord.password, salt),
|
97
|
+
passwordUpdatedAt: new Date(),
|
98
|
+
creator: user,
|
99
|
+
updater: user
|
100
|
+
});
|
80
101
|
// repository api는 작동하지 않음.
|
81
102
|
// await tx
|
82
103
|
// .createQueryBuilder()
|
@@ -87,7 +108,7 @@ let UserMutation = class UserMutation {
|
|
87
108
|
// domainsId: domain.id
|
88
109
|
// })
|
89
110
|
// .execute()
|
90
|
-
results.push(
|
111
|
+
results.push({ ...result, cuFlag: '+' });
|
91
112
|
}
|
92
113
|
}
|
93
114
|
if (_updateRecords.length > 0) {
|
@@ -98,7 +119,13 @@ let UserMutation = class UserMutation {
|
|
98
119
|
// User.validatePasswordByRule(updateRecord.password, context.lng)
|
99
120
|
const user = await userRepo.findOne({ where: { id: updateRecord.id }, relations: ['domains'] });
|
100
121
|
var domains = user.domains.find(d => d.id === domain.id) ? user.domains : [...user.domains, domain];
|
101
|
-
const result = await userRepo.save(
|
122
|
+
const result = await userRepo.save({
|
123
|
+
...user,
|
124
|
+
...updateRecord,
|
125
|
+
domains,
|
126
|
+
password: updateRecord.password ? user_js_1.User.encode(updateRecord.password, user.salt) : user.password,
|
127
|
+
updater: user
|
128
|
+
});
|
102
129
|
if (!updateRecord.status) {
|
103
130
|
continue;
|
104
131
|
}
|
@@ -119,7 +146,7 @@ let UserMutation = class UserMutation {
|
|
119
146
|
// })
|
120
147
|
// .execute()
|
121
148
|
// }
|
122
|
-
results.push(
|
149
|
+
results.push({ ...result, cuFlag: 'M' });
|
123
150
|
}
|
124
151
|
}
|
125
152
|
return results;
|
@@ -215,7 +242,6 @@ let UserMutation = class UserMutation {
|
|
215
242
|
return true;
|
216
243
|
}
|
217
244
|
async activateUser(username, context) {
|
218
|
-
var _a;
|
219
245
|
const { tx, domain } = context.state;
|
220
246
|
const userRepository = (0, shell_1.getRepository)(user_js_1.User, tx);
|
221
247
|
var targetUser = await userRepository.findOne({
|
@@ -231,7 +257,7 @@ let UserMutation = class UserMutation {
|
|
231
257
|
if (!targetUser) {
|
232
258
|
throw new Error(context.t('error.failed to find x', { x: context.t('field.user') }));
|
233
259
|
}
|
234
|
-
if (!
|
260
|
+
if (!targetUser?.domains?.find((userDomain) => userDomain.id === domain.id)) {
|
235
261
|
throw new Error('User is not belong to domain');
|
236
262
|
}
|
237
263
|
targetUser.failCount = 0;
|
@@ -240,7 +266,6 @@ let UserMutation = class UserMutation {
|
|
240
266
|
return true;
|
241
267
|
}
|
242
268
|
async inactivateUser(username, context) {
|
243
|
-
var _a;
|
244
269
|
const { tx, domain } = context.state;
|
245
270
|
const userRepository = (0, shell_1.getRepository)(user_js_1.User, tx);
|
246
271
|
var targetUser = await userRepository.findOne({
|
@@ -256,7 +281,7 @@ let UserMutation = class UserMutation {
|
|
256
281
|
if (!targetUser) {
|
257
282
|
throw new Error(context.t('error.failed to find x', { x: context.t('field.user') }));
|
258
283
|
}
|
259
|
-
if (!
|
284
|
+
if (!targetUser?.domains?.find((userDomain) => userDomain.id === domain.id)) {
|
260
285
|
throw new Error('User is not belong to domain');
|
261
286
|
}
|
262
287
|
if (targetUser.userType == 'admin' || targetUser.id === domain.owner) {
|
@@ -267,7 +292,6 @@ let UserMutation = class UserMutation {
|
|
267
292
|
return true;
|
268
293
|
}
|
269
294
|
async resetPasswordToDefault(username, context) {
|
270
|
-
var _a;
|
271
295
|
const { tx, domain } = context.state;
|
272
296
|
const { defaultPassword } = env_1.config.get('password');
|
273
297
|
if (!defaultPassword) {
|
@@ -287,7 +311,7 @@ let UserMutation = class UserMutation {
|
|
287
311
|
if (!targetUser) {
|
288
312
|
throw new Error(context.t('error.failed to find x', { x: context.t('field.user') }));
|
289
313
|
}
|
290
|
-
if (!
|
314
|
+
if (!targetUser?.domains?.find((userDomain) => userDomain.id === domain.id)) {
|
291
315
|
throw new Error('User is not belong to domain');
|
292
316
|
}
|
293
317
|
targetUser.salt = user_js_1.User.generateSalt();
|
@@ -324,8 +348,10 @@ exports.UserMutation = UserMutation;
|
|
324
348
|
tslib_1.__decorate([
|
325
349
|
(0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "mutation", domainOwnerGranted: true)'),
|
326
350
|
(0, type_graphql_1.Directive)('@transaction'),
|
327
|
-
(0, type_graphql_1.Mutation)(returns => user_js_1.User, {
|
328
|
-
|
351
|
+
(0, type_graphql_1.Mutation)(returns => user_js_1.User, {
|
352
|
+
description: 'Creates a new user in the system. Use this mutation to register a user with the specified credentials and domain information.'
|
353
|
+
}),
|
354
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('user', { description: 'The input object containing new user information.' })),
|
329
355
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
330
356
|
tslib_1.__metadata("design:type", Function),
|
331
357
|
tslib_1.__metadata("design:paramtypes", [user_types_js_1.NewUser, Object]),
|
@@ -334,9 +360,11 @@ tslib_1.__decorate([
|
|
334
360
|
tslib_1.__decorate([
|
335
361
|
(0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "mutation", domainOwnerGranted: true)'),
|
336
362
|
(0, type_graphql_1.Directive)('@transaction'),
|
337
|
-
(0, type_graphql_1.Mutation)(returns => user_js_1.User, {
|
338
|
-
|
339
|
-
|
363
|
+
(0, type_graphql_1.Mutation)(returns => user_js_1.User, {
|
364
|
+
description: 'Updates the information of an existing user. Use this mutation to modify user profile details, such as name, email, or roles.'
|
365
|
+
}),
|
366
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('email', type => graphql_scalars_1.GraphQLEmailAddress, { description: 'The email address of the user to update.' })),
|
367
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch', { description: 'The patch object containing updated user fields.' })),
|
340
368
|
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
341
369
|
tslib_1.__metadata("design:type", Function),
|
342
370
|
tslib_1.__metadata("design:paramtypes", [String, user_types_js_1.UserPatch, Object]),
|
@@ -345,8 +373,10 @@ tslib_1.__decorate([
|
|
345
373
|
tslib_1.__decorate([
|
346
374
|
(0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "mutation", domainOwnerGranted: true)'),
|
347
375
|
(0, type_graphql_1.Directive)('@transaction'),
|
348
|
-
(0, type_graphql_1.Mutation)(returns => [user_js_1.User], {
|
349
|
-
|
376
|
+
(0, type_graphql_1.Mutation)(returns => [user_js_1.User], {
|
377
|
+
description: 'Updates or creates multiple users in a single operation. Use this mutation for batch processing of user records.'
|
378
|
+
}),
|
379
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [user_types_js_1.UserPatch], { description: 'An array of patch objects for batch update or creation.' })),
|
350
380
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
351
381
|
tslib_1.__metadata("design:type", Function),
|
352
382
|
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
@@ -355,8 +385,10 @@ tslib_1.__decorate([
|
|
355
385
|
tslib_1.__decorate([
|
356
386
|
(0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "mutation", domainOwnerGranted: true)'),
|
357
387
|
(0, type_graphql_1.Directive)('@transaction'),
|
358
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
359
|
-
|
388
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
389
|
+
description: 'Deletes a user from the system by their username. Use this mutation to permanently remove a user account and revoke their access.'
|
390
|
+
}),
|
391
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('username', { description: 'The username of the user to delete.' })),
|
360
392
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
361
393
|
tslib_1.__metadata("design:type", Function),
|
362
394
|
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
@@ -365,8 +397,10 @@ tslib_1.__decorate([
|
|
365
397
|
tslib_1.__decorate([
|
366
398
|
(0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "mutation", domainOwnerGranted: true)'),
|
367
399
|
(0, type_graphql_1.Directive)('@transaction'),
|
368
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
369
|
-
|
400
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
401
|
+
description: 'Deletes multiple users from the system by their usernames. Use this mutation to remove several user accounts at once.'
|
402
|
+
}),
|
403
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('usernames', type => [String], { description: 'An array of usernames to delete.' })),
|
370
404
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
371
405
|
tslib_1.__metadata("design:type", Function),
|
372
406
|
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
@@ -374,8 +408,10 @@ tslib_1.__decorate([
|
|
374
408
|
], UserMutation.prototype, "deleteUsers", null);
|
375
409
|
tslib_1.__decorate([
|
376
410
|
(0, type_graphql_1.Directive)('@transaction'),
|
377
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
378
|
-
|
411
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
412
|
+
description: 'Invites an existing user to join the current domain. Use this mutation to add a user to a domain if they already exist in the system.'
|
413
|
+
}),
|
414
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('username', { description: 'The username or email of the user to invite.' })),
|
379
415
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
380
416
|
tslib_1.__metadata("design:type", Function),
|
381
417
|
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
@@ -384,8 +420,10 @@ tslib_1.__decorate([
|
|
384
420
|
tslib_1.__decorate([
|
385
421
|
(0, type_graphql_1.Directive)('@transaction'),
|
386
422
|
(0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "mutation", domainOwnerGranted: true)'),
|
387
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
388
|
-
|
423
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
424
|
+
description: 'Removes a user from the current domain. Use this mutation to revoke a user\'s access to a specific domain without deleting their account.'
|
425
|
+
}),
|
426
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('username', { description: 'The username or email of the user to remove from the domain.' })),
|
389
427
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
390
428
|
tslib_1.__metadata("design:type", Function),
|
391
429
|
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
@@ -394,8 +432,10 @@ tslib_1.__decorate([
|
|
394
432
|
tslib_1.__decorate([
|
395
433
|
(0, type_graphql_1.Directive)('@privilege(domainOwnerGranted: true, superUserGranted: true)'),
|
396
434
|
(0, type_graphql_1.Directive)('@transaction'),
|
397
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
398
|
-
|
435
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
436
|
+
description: 'Transfers domain ownership to another user. Use this mutation to assign the owner role to a different user within the domain.'
|
437
|
+
}),
|
438
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('username', { description: 'The username or email of the user to transfer ownership to.' })),
|
399
439
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
400
440
|
tslib_1.__metadata("design:type", Function),
|
401
441
|
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
@@ -404,8 +444,10 @@ tslib_1.__decorate([
|
|
404
444
|
tslib_1.__decorate([
|
405
445
|
(0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "mutation", domainOwnerGranted: true)'),
|
406
446
|
(0, type_graphql_1.Directive)('@transaction'),
|
407
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
408
|
-
|
447
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
448
|
+
description: 'Activates a user account in the current domain. Use this mutation to enable a user who was previously inactive.'
|
449
|
+
}),
|
450
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('username', { description: 'The username or email of the user to activate.' })),
|
409
451
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
410
452
|
tslib_1.__metadata("design:type", Function),
|
411
453
|
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
@@ -414,8 +456,10 @@ tslib_1.__decorate([
|
|
414
456
|
tslib_1.__decorate([
|
415
457
|
(0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "mutation", domainOwnerGranted: true)'),
|
416
458
|
(0, type_graphql_1.Directive)('@transaction'),
|
417
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
418
|
-
|
459
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
460
|
+
description: 'Inactivates a user account in the current domain. Use this mutation to disable a user, making them unable to log in.'
|
461
|
+
}),
|
462
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('username', { description: 'The username or email of the user to inactivate.' })),
|
419
463
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
420
464
|
tslib_1.__metadata("design:type", Function),
|
421
465
|
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
@@ -424,8 +468,10 @@ tslib_1.__decorate([
|
|
424
468
|
tslib_1.__decorate([
|
425
469
|
(0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "mutation", domainOwnerGranted: true)'),
|
426
470
|
(0, type_graphql_1.Directive)('@transaction'),
|
427
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
428
|
-
|
471
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
472
|
+
description: 'Resets a user\'s password to the default value. Use this mutation to restore access to a user who has forgotten their password.'
|
473
|
+
}),
|
474
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('username', { description: 'The username or email of the user whose password to reset.' })),
|
429
475
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
430
476
|
tslib_1.__metadata("design:type", Function),
|
431
477
|
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
@@ -434,10 +480,12 @@ tslib_1.__decorate([
|
|
434
480
|
tslib_1.__decorate([
|
435
481
|
(0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "mutation", domainOwnerGranted: true)'),
|
436
482
|
(0, type_graphql_1.Directive)('@transaction'),
|
437
|
-
(0, type_graphql_1.Mutation)(returns => user_js_1.User, {
|
438
|
-
|
439
|
-
|
440
|
-
tslib_1.__param(
|
483
|
+
(0, type_graphql_1.Mutation)(returns => user_js_1.User, {
|
484
|
+
description: 'Updates the roles assigned to a user. Use this mutation to change a user\'s permissions within the domain.'
|
485
|
+
}),
|
486
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('username', { description: 'The username or email of the user whose roles to update.' })),
|
487
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('availableRoles', type => [shell_1.ObjectRef], { description: 'The list of roles that can be assigned to the user.' })),
|
488
|
+
tslib_1.__param(2, (0, type_graphql_1.Arg)('selectedRoles', type => [shell_1.ObjectRef], { description: 'The list of roles to be assigned to the user.' })),
|
441
489
|
tslib_1.__param(3, (0, type_graphql_1.Ctx)()),
|
442
490
|
tslib_1.__metadata("design:type", Function),
|
443
491
|
tslib_1.__metadata("design:paramtypes", [String, Array, Array, Object]),
|