/** * Adds a new DOL descriptor instance to the descriptor instance associated with * this XMLNode * * @param mewDescriptor the new descriptor */ public void addDescriptor(Object newDescriptor) { if (newDescriptor instanceof SecurityRoleMapping) { SecurityRoleMapping roleMap = (SecurityRoleMapping) newDescriptor; descriptor.addSecurityRoleMapping(roleMap); if (descriptor!=null && !descriptor.isVirtual()) { Role role = new Role(roleMap.getRoleName()); SecurityRoleMapper rm = descriptor.getRoleMapper(); if (rm != null) { List<PrincipalNameDescriptor> principals = roleMap.getPrincipalNames(); for (int i = 0; i < principals.size(); i++) { rm.assignRole(principals.get(i).getPrincipal(), role, descriptor); } List<String> groups = roleMap.getGroupNames(); for (int i = 0; i < groups.size(); i++) { rm.assignRole(new Group(groups.get(i)), role, descriptor); } } } } }
/** * Adds a new DOL descriptor instance to the descriptor instance associated with * this XMLNode * * @param descriptor the new descriptor */ public void addDescriptor(Object newDescriptor) { if (newDescriptor instanceof SecurityRoleMapping) { SecurityRoleMapping roleMap = (SecurityRoleMapping)newDescriptor; descriptor.addSecurityRoleMapping(roleMap); Application app = descriptor.getApplication(); if (app!=null) { Role role = new Role(roleMap.getRoleName()); SecurityRoleMapper rm = app.getRoleMapper(); if (rm != null) { List<PrincipalNameDescriptor> principals = roleMap.getPrincipalNames(); for (int i = 0; i < principals.size(); i++) { rm.assignRole(principals.get(i).getPrincipal(), role, descriptor); } List<String> groups = roleMap.getGroupNames(); for (int i = 0; i < groups.size(); i++) { rm.assignRole(new Group(groups.get(i)), role, descriptor); } } } } }
if (rm != null) { if(roleMap.isExternallyDefined()){ rm.assignRole(new Group(roleMap.getRoleName()), role, descriptor); } else { List<String> principals = roleMap.getPrincipalNames(); for (int i = 0; i < principals.size(); i++) { rm.assignRole(new PrincipalImpl(principals.get(i)), role, descriptor);
rm.assignRole(new Group(role.getName()), role, descriptor); } else { List<String> principals = roleMap.getPrincipalNames(); for (int i = 0; i < principals.size(); i++) { rm.assignRole(new PrincipalImpl(principals.get(i)), role, descriptor);
List<PrincipalNameDescriptor> principals = srm.getPrincipalNames(); for (int i = 0; i < principals.size(); i++) { rm.assignRole(principals.get(i).getPrincipal(), role, descriptor); rm.assignRole(new Group(groups.get(i)), role, descriptor);