コード例 #1
0
 @Override
 public void updateRole(RoleDto role) {
   MotechRole motechRole = allMotechRoles.findByRoleName(role.getOriginalRoleName());
   motechRole.setRoleName(role.getRoleName());
   motechRole.setPermissionNames(role.getPermissionNames());
   List<MotechUser> users =
       (List<MotechUser>) allMotechUsers.findByRole(role.getOriginalRoleName());
   for (MotechUser user : users) {
     List<String> roleList = user.getRoles();
     roleList.remove(role.getOriginalRoleName());
     roleList.add(role.getRoleName());
     allMotechUsers.update(user);
   }
   allMotechRoles.update(motechRole);
 }
コード例 #2
0
 @Override
 public void createRole(RoleDto role) {
   MotechRole motechRole =
       new MotechRoleCouchdbImpl(role.getRoleName(), role.getPermissionNames());
   allMotechRoles.add(motechRole);
 }
コード例 #3
0
 @Override
 public void deleteRole(RoleDto role) {
   MotechRole motechRole = allMotechRoles.findByRoleName(role.getRoleName());
   allMotechRoles.remove(motechRole);
 }