SUPPORT-8957: fix account action
This commit is contained in:
parent
ac46025a0c
commit
07cedf50c7
4 changed files with 34 additions and 14 deletions
|
|
@ -1,19 +1,24 @@
|
|||
import {
|
||||
AnalyticalScope,
|
||||
Behavior,
|
||||
NotNull,
|
||||
SaveButton
|
||||
NotNull, ObjectRef,
|
||||
SaveButton, TextField, Visible
|
||||
} 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";
|
||||
|
||||
@AnalyticalScope(SaveButton)
|
||||
export class UserManagementService extends Behavior {
|
||||
|
||||
@NotNull()
|
||||
public action: AccountAction;
|
||||
@Visible("action == AccountAction.EDIT")
|
||||
@NotNull("action == AccountAction.EDIT")
|
||||
@ObjectRef()
|
||||
public applicationKind: TextField;
|
||||
|
||||
private button: SaveButton;
|
||||
private httpClient: HttpClient;
|
||||
|
|
@ -34,14 +39,20 @@ export class UserManagementService extends Behavior {
|
|||
case AccountAction.CREATE:
|
||||
this.doRequest("user", jsonObj);
|
||||
break;
|
||||
case AccountAction.EDIT_PERSON:
|
||||
this.doRequest("user/person", jsonObj);
|
||||
break;
|
||||
case AccountAction.EDIT_ACCOUNT:
|
||||
this.doRequest("user/account", jsonObj);
|
||||
break;
|
||||
case AccountAction.EDIT_ROLES:
|
||||
this.doRequest("user/roles", jsonObj);
|
||||
case AccountAction.EDIT:
|
||||
let kind = this.applicationKind.getValue();
|
||||
|
||||
switch (kind) {
|
||||
case ApplicationKind.EDIT_USER_MAIN:
|
||||
this.doRequest("user/person", jsonObj);
|
||||
break;
|
||||
case ApplicationKind.EDIT_USER_ACCOUNT:
|
||||
this.doRequest("user/account", jsonObj);
|
||||
break;
|
||||
case ApplicationKind.EDIT_USER_ROLES:
|
||||
this.doRequest("user/roles", jsonObj);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case AccountAction.DEACTIVATE:
|
||||
this.doRequest("users/deactivation", jsonObj);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
export enum AccountAction {
|
||||
CREATE = "CREATE",
|
||||
EDIT_PERSON = "EDIT_PERSON",
|
||||
EDIT_ACCOUNT = "EDIT_ACCOUNT",
|
||||
EDIT_ROLES = "EDIT_ROLES",
|
||||
EDIT = "EDIT",
|
||||
DEACTIVATE = "DEACTIVATE"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
export enum ApplicationKind {
|
||||
EDIT_USER_MAIN = "EDIT_USER_MAIN",
|
||||
EDIT_USER_ACCOUNT = "EDIT_USER_ACCOUNT",
|
||||
EDIT_USER_ROLES = "EDIT_USER_ROLES"
|
||||
}
|
||||
|
|
@ -7624,7 +7624,13 @@
|
|||
<entry>
|
||||
<key>action</key>
|
||||
<value>
|
||||
<simple>"CREATE"</simple>
|
||||
<simple>"EDIT"</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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue