|
|
|
@ -2,10 +2,14 @@ package info.bukova.isspst.ui.users;
|
|
|
|
|
|
|
|
|
|
import info.bukova.isspst.Constants;
|
|
|
|
|
import info.bukova.isspst.Module;
|
|
|
|
|
import info.bukova.isspst.StringUtils;
|
|
|
|
|
import info.bukova.isspst.data.Role;
|
|
|
|
|
import info.bukova.isspst.data.Workgroup;
|
|
|
|
|
import info.bukova.isspst.services.users.PermissionService;
|
|
|
|
|
import info.bukova.isspst.services.users.RoleService;
|
|
|
|
|
import info.bukova.isspst.ui.FormViewModel;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
@ -16,11 +20,30 @@ public class PermissionForm extends FormViewModel<Role> {
|
|
|
|
|
|
|
|
|
|
@WireVariable
|
|
|
|
|
private PermissionService permissionService;
|
|
|
|
|
@WireVariable
|
|
|
|
|
private RoleService roleService;
|
|
|
|
|
private RolePermissions rolePerms;
|
|
|
|
|
private boolean canChangeWorkgroup;
|
|
|
|
|
private boolean canChangeCentre;
|
|
|
|
|
private boolean inWorkflow;
|
|
|
|
|
private List<String> usage;
|
|
|
|
|
|
|
|
|
|
@Init(superclass = true)
|
|
|
|
|
public void init() {
|
|
|
|
|
rolePerms = new RolePermissions(getDataBean(), permissionService.getAll());
|
|
|
|
|
canChangeWorkgroup = roleService.canChangeWorkgroup(getDataBean());
|
|
|
|
|
canChangeCentre = roleService.canChangeCenter(getDataBean());
|
|
|
|
|
inWorkflow = roleService.isInWorkflow(getDataBean());
|
|
|
|
|
List<Workgroup> wgList = roleService.getRoleUsage(getDataBean());
|
|
|
|
|
usage = new ArrayList<String>();
|
|
|
|
|
|
|
|
|
|
for (Workgroup w : wgList) {
|
|
|
|
|
usage.add(w.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (inWorkflow) {
|
|
|
|
|
usage.add(StringUtils.localize("Workflow"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Module> getModules() {
|
|
|
|
@ -31,4 +54,20 @@ public class PermissionForm extends FormViewModel<Role> {
|
|
|
|
|
return rolePerms;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isCanChangeWorkgroup() {
|
|
|
|
|
return canChangeWorkgroup;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isCanChangeCentre() {
|
|
|
|
|
return canChangeCentre;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isInWorkflow() {
|
|
|
|
|
return inWorkflow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<String> getUsage() {
|
|
|
|
|
return usage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|