|
|
|
@ -1,8 +1,10 @@
|
|
|
|
|
package info.bukova.isspst.ui.workgroups;
|
|
|
|
|
|
|
|
|
|
import info.bukova.isspst.Constants;
|
|
|
|
|
import info.bukova.isspst.data.JobMapping;
|
|
|
|
|
import info.bukova.isspst.data.Member;
|
|
|
|
|
import info.bukova.isspst.data.Role;
|
|
|
|
|
import info.bukova.isspst.data.User;
|
|
|
|
|
import info.bukova.isspst.data.Workgroup;
|
|
|
|
|
import info.bukova.isspst.services.users.RoleService;
|
|
|
|
|
import info.bukova.isspst.services.users.UserService;
|
|
|
|
@ -66,6 +68,19 @@ public class WorkgroupForm extends FormViewModel<Workgroup> {
|
|
|
|
|
@NotifyChange({"workgroupRoles", "centre", "users"})
|
|
|
|
|
public void setCentre(boolean centre) {
|
|
|
|
|
getDataBean().setCentre(centre);
|
|
|
|
|
getDataBean().getMembers().clear();
|
|
|
|
|
|
|
|
|
|
if (centre) {
|
|
|
|
|
List<Role> centreRoles = roleService.getCentreRoles();
|
|
|
|
|
for (Role r : centreRoles) {
|
|
|
|
|
if (!r.getAuthority().equals(Constants.ROLE_USER)) {
|
|
|
|
|
List<User> users = userService.getUsersWithRole(r);
|
|
|
|
|
for (User u : users) {
|
|
|
|
|
workgroupService.addMember(getDataBean(), u, r);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean getCentre() {
|
|
|
|
|