示例#1
0
 public synchronized void removeRole(Role r) {
   if (isDataEditable(ResUnit.Role)) {
     disconnectResources(r);
     for (Role role : getRoles()) {
       Role owner = role.getOwnerRole();
       if ((owner != null) && owner.getID().equals(r.getID())) {
         role.setOwnerRole((Role) null);
         getDataSource(ResUnit.Role).update(role);
       }
     }
     delRole(r);
     getDataSource(ResUnit.Role).delete(r);
   }
 }
示例#2
0
 public String checkCyclicRoleReference(Role role, String refID) {
   String result = null;
   List<String> hierarchy = new ArrayList<String>();
   hierarchy.add(role.getName());
   Role owner = getRole(refID);
   String refName = owner.getName(); // name of role attempting to add to
   while (owner != null) {
     hierarchy.add(owner.getName());
     if (owner.equals(role)) {
       result = constructCyclicAttributeErrorMessage(hierarchy, "role", refName);
       break;
     }
     owner = owner.getOwnerRole();
   }
   return result;
 }