SUPPORT-9012: fix user management service and page
This commit is contained in:
parent
3abb735528
commit
9f9c52d2d8
4 changed files with 29 additions and 182 deletions
|
|
@ -4,12 +4,10 @@ import {
|
|||
NotNull,
|
||||
ObjectRef,
|
||||
SaveButton,
|
||||
TextField,
|
||||
Visible
|
||||
TextField
|
||||
} from "@webbpm/base-package";
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {FormField} from "../field/FormField";
|
||||
import {AccountAction} from "../enum/AccountAction";
|
||||
import {AuthorizationService} from "../../../modules/app/service/authorization.service";
|
||||
import {ApplicationKind} from "../enum/ApplicationKind";
|
||||
|
||||
|
|
@ -17,9 +15,6 @@ import {ApplicationKind} from "../enum/ApplicationKind";
|
|||
export class UserManagementService extends Behavior {
|
||||
|
||||
@NotNull()
|
||||
public action: AccountAction;
|
||||
@Visible("action == AccountAction.EDIT")
|
||||
@NotNull("action == AccountAction.EDIT")
|
||||
@ObjectRef()
|
||||
public applicationKind: TextField;
|
||||
|
||||
|
|
@ -37,15 +32,12 @@ export class UserManagementService extends Behavior {
|
|||
return;
|
||||
}
|
||||
let jsonObj = this.collectData();
|
||||
|
||||
switch (this.action) {
|
||||
case AccountAction.CREATE:
|
||||
this.doRequest("user", jsonObj);
|
||||
break;
|
||||
case AccountAction.EDIT:
|
||||
let kind = this.applicationKind.getValue();
|
||||
|
||||
switch (kind) {
|
||||
case ApplicationKind.CREATE_USER:
|
||||
this.doRequest("user", jsonObj);
|
||||
break;
|
||||
case ApplicationKind.EDIT_USER_MAIN:
|
||||
this.doRequest("user/person", jsonObj);
|
||||
break;
|
||||
|
|
@ -55,28 +47,16 @@ export class UserManagementService extends Behavior {
|
|||
case ApplicationKind.EDIT_USER_ROLES:
|
||||
this.doRequest("user/roles", jsonObj);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case AccountAction.DEACTIVATE:
|
||||
case ApplicationKind.BLOCK_USER:
|
||||
this.doRequest("users/deactivation", jsonObj);
|
||||
break;
|
||||
case AccountAction.RESET_PASSWORD:
|
||||
case ApplicationKind.RESET_PASSWORD:
|
||||
this.doRequest("user/password/reset", jsonObj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Visible()
|
||||
public setAccountAction(actionName: string): void {
|
||||
try {
|
||||
this.action = AccountAction[actionName];
|
||||
}
|
||||
catch (error) {
|
||||
console.error(`Unsupported action name ${actionName}`, error);
|
||||
}
|
||||
}
|
||||
|
||||
private collectData(): any {
|
||||
let jsonObj = {};
|
||||
let fields: FormField[] = this.button.form.getScriptsInChildren(FormField);
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
export enum AccountAction {
|
||||
CREATE = "CREATE",
|
||||
EDIT = "EDIT",
|
||||
DEACTIVATE = "DEACTIVATE",
|
||||
RESET_PASSWORD="RESET_PASSWORD"
|
||||
}
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
export enum ApplicationKind {
|
||||
CREATE_USER = "CREATE_USER",
|
||||
EDIT_USER_MAIN = "EDIT_USER_MAIN",
|
||||
EDIT_USER_ACCOUNT = "EDIT_USER_ACCOUNT",
|
||||
EDIT_USER_ROLES = "EDIT_USER_ROLES"
|
||||
EDIT_USER_ROLES = "EDIT_USER_ROLES",
|
||||
BLOCK_USER = "BLOCK_USER",
|
||||
RESET_PASSWORD = "RESET_PASSWORD"
|
||||
}
|
||||
|
|
@ -307,41 +307,7 @@
|
|||
</complex>
|
||||
</value>
|
||||
</item>
|
||||
<item id="6906cc9a-779f-4b6f-a79a-8b2252f2e0ea" removed="false">
|
||||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>behavior</key>
|
||||
<value>
|
||||
<simple>{"objectId":"dd6db966-9599-4483-9eae-12718b7f081b","packageName":"account_applications.component.button","className":"UserManagementService","type":"TS"}</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>method</key>
|
||||
<value>
|
||||
<simple>"setAccountAction"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>value</key>
|
||||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>staticValue</key>
|
||||
<value>
|
||||
<implRef type="TS">
|
||||
<className>string</className>
|
||||
<packageName></packageName>
|
||||
</implRef>
|
||||
<simple>"CREATE"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
</complex>
|
||||
</value>
|
||||
</entry>
|
||||
</complex>
|
||||
</value>
|
||||
</item>
|
||||
<item id="6906cc9a-779f-4b6f-a79a-8b2252f2e0ea" removed="true"/>
|
||||
<item id="7534fce5-f3b2-446c-bea5-d092d38693dd" removed="true"/>
|
||||
<item id="09d5c116-dbac-4817-a43d-a1273df74f31" removed="true"/>
|
||||
</value>
|
||||
|
|
@ -790,41 +756,7 @@
|
|||
</complex>
|
||||
</value>
|
||||
</item>
|
||||
<item id="6de21983-7945-4220-b3cf-179387d91fd7" removed="false">
|
||||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>behavior</key>
|
||||
<value>
|
||||
<simple>{"objectId":"dd6db966-9599-4483-9eae-12718b7f081b","packageName":"account_applications.component.button","className":"UserManagementService","type":"TS"}</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>method</key>
|
||||
<value>
|
||||
<simple>"setAccountAction"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>value</key>
|
||||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>staticValue</key>
|
||||
<value>
|
||||
<implRef type="TS">
|
||||
<className>string</className>
|
||||
<packageName></packageName>
|
||||
</implRef>
|
||||
<simple>"EDIT"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
</complex>
|
||||
</value>
|
||||
</entry>
|
||||
</complex>
|
||||
</value>
|
||||
</item>
|
||||
<item id="6de21983-7945-4220-b3cf-179387d91fd7" removed="true"/>
|
||||
<item id="43b072fa-d2d9-479d-b38f-a4cdc4a3e798" removed="true"/>
|
||||
<item id="09d5c116-dbac-4817-a43d-a1273df74f31" removed="true"/>
|
||||
</value>
|
||||
|
|
@ -987,41 +919,7 @@
|
|||
</complex>
|
||||
</value>
|
||||
</item>
|
||||
<item id="dc389089-75a9-4406-82bc-8fb9a4488631" removed="false">
|
||||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>behavior</key>
|
||||
<value>
|
||||
<simple>{"objectId":"dd6db966-9599-4483-9eae-12718b7f081b","packageName":"account_applications.component.button","className":"UserManagementService","type":"TS"}</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>method</key>
|
||||
<value>
|
||||
<simple>"setAccountAction"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>value</key>
|
||||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>staticValue</key>
|
||||
<value>
|
||||
<implRef type="TS">
|
||||
<className>string</className>
|
||||
<packageName></packageName>
|
||||
</implRef>
|
||||
<simple>"DEACTIVATE"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
</complex>
|
||||
</value>
|
||||
</entry>
|
||||
</complex>
|
||||
</value>
|
||||
</item>
|
||||
<item id="dc389089-75a9-4406-82bc-8fb9a4488631" removed="true"/>
|
||||
<item id="b4e369c2-515c-494b-930e-5097408cb0ff" removed="true"/>
|
||||
<item id="09d5c116-dbac-4817-a43d-a1273df74f31" removed="true"/>
|
||||
</value>
|
||||
|
|
@ -1191,41 +1089,7 @@
|
|||
</complex>
|
||||
</value>
|
||||
</item>
|
||||
<item id="57f15c3b-bf56-440c-bf42-7524bacc37c1" removed="false">
|
||||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>behavior</key>
|
||||
<value>
|
||||
<simple>{"objectId":"dd6db966-9599-4483-9eae-12718b7f081b","packageName":"account_applications.component.button","className":"UserManagementService","type":"TS"}</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>method</key>
|
||||
<value>
|
||||
<simple>"setAccountAction"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>value</key>
|
||||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>staticValue</key>
|
||||
<value>
|
||||
<implRef type="TS">
|
||||
<className>string</className>
|
||||
<packageName></packageName>
|
||||
</implRef>
|
||||
<simple>"RESET_PASSWORD"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
</complex>
|
||||
</value>
|
||||
</entry>
|
||||
</complex>
|
||||
</value>
|
||||
</item>
|
||||
<item id="57f15c3b-bf56-440c-bf42-7524bacc37c1" removed="true"/>
|
||||
<item id="7534fce5-f3b2-446c-bea5-d092d38693dd" removed="true"/>
|
||||
<item id="09d5c116-dbac-4817-a43d-a1273df74f31" removed="true"/>
|
||||
</value>
|
||||
|
|
@ -9025,6 +8889,12 @@
|
|||
<simple>"CREATE"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>applicationKind</key>
|
||||
<value>
|
||||
<simple>{"objectId":"9e772048-b43f-42f1-a370-2519dd4f6ad7","packageName":"component.field","className":"TextField","type":"TS"}</simple>
|
||||
</value>
|
||||
</entry>
|
||||
</properties>
|
||||
</scripts>
|
||||
</children>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue