- excludes remove process in GroupConversion
- changes process of PermissionConverion
- new error message in PermissionIdGenerator

git-svn-id: https://svn.libreccm.org/ccm/trunk@4660 8810af33-2d31-482b-a856-94f89814c4df
master
tosmers 2017-04-05 15:09:14 +00:00
parent f4699b096a
commit c3cbf3a90e
3 changed files with 34 additions and 42 deletions

View File

@ -49,12 +49,12 @@ public class GroupConversion {
roleGroups = new ArrayList<>();
trunkGroups = com.arsdigita.kernel.Group.getAllObjectGroups();
List<com.arsdigita.kernel.Role> trunkRoles = com.arsdigita.kernel
.Role.getAllObjectRoles();
trunkRoles.forEach(role -> roleGroups.add(role.getGroup()));
// List<com.arsdigita.kernel.Role> trunkRoles = com.arsdigita.kernel
// .Role.getAllObjectRoles();
// trunkRoles.forEach(role -> roleGroups.add(role.getGroup()));
// remove subgroups representing roles
trunkGroups.removeAll(roleGroups);
// trunkGroups.removeAll(roleGroups);
createGroupsAndSetAssociations(trunkGroups);
}

View File

@ -145,48 +145,39 @@ public class PermissionConversion {
com.arsdigita.kernel.Group trunkGranteeGroup =
(com.arsdigita.kernel.Group) trunkGranteeParty;
RoleCollection roleCollection = ((com.arsdigita.kernel.
Group) trunkGranteeParty).getRoles();
RoleCollection roleCollection = trunkGranteeGroup.getRoles();
// if group contains 1 or more roles
if (!roleCollection.isEmpty()) {
boolean multipleGrantees = false;
while (roleCollection.next()) {
Role grantee = NgCollection.roles.get(roleCollection
.getRole().getID().longValue());
// set grantee and opposed associations
if (!multipleGrantees) {
permission.setGrantee(grantee);
grantee.addPermission(permission);
multipleGrantees = true;
} else {
Permission duplicatePermission = new Permission
(permission);
duplicatePermission.setGrantee(grantee);
grantee.addPermission(duplicatePermission);
Permission duplicatePermission = new Permission
(permission);
duplicatePermission.setGrantee(grantee);
grantee.addPermission(duplicatePermission);
CcmObject object = duplicatePermission.getObject();
long objectId = 0;
if (object != null) {
objectId = object.getObjectId();
}
long oldId = objectId + grantee.getRoleId();
PermissionIdMapper.map.put(oldId,
duplicatePermission.getPermissionId());
CcmObject object = duplicatePermission.getObject();
long objectId = 0;
if (object != null) {
objectId = object.getObjectId();
}
long oldId = objectId + grantee.getRoleId();
PermissionIdMapper.map.put(oldId,
duplicatePermission.getPermissionId());
}
// if group contains no roles, new Role necessary
} else {
Group member = NgCollection.groups.get
(trunkGranteeParty.getID().longValue());
Role granteeRole = createNewRole(member);
// set grantee and opposed association
permission.setGrantee(granteeRole);
granteeRole.addPermission(permission);
}
// new Role for this group
Group member = NgCollection.groups.get
(trunkGranteeGroup.getID().longValue());
Role granteeRole = createNewRole(member);
// set grantee and opposed association
permission.setGrantee(granteeRole);
granteeRole.addPermission(permission);
// grantee instance of User, new Role necessary
} else if (trunkGranteeParty instanceof com.arsdigita.kernel
@ -202,10 +193,10 @@ public class PermissionConversion {
// set grantee and opposed association
permission.setGrantee(granteeRole);
granteeRole.addPermission(permission);
} else {
System.err.printf("!!!Failed to convert grantee for permission %s%n",
trunkPermission.getOID().toString());
}
System.err.printf("!!!Failed to convert grantee for permission %s%n",
trunkPermission.getOID().toString());
}
}
}

View File

@ -74,9 +74,10 @@ public class PermissionIdGenerator extends ObjectIdGenerator<String> {
b = true;
}
// if (!(a || b)) {
// throw new IllegalStateException();
// }
if (!(a || b)) {
System.err.printf("!!!Object and Grantee are empty.. %s%n",
permission.getGrantedPrivilege());
}
return id;
}