private void loadRoleDns(Group group) throws SecurityException { if (CollectionUtils.isNotEmpty(group.getMembers())) { ReviewMgr reviewMgr = ReviewMgrFactory.createInstance(this.contextId); List<String> roleDns = new ArrayList<String>(); for (String member : group.getMembers()) { Role role = reviewMgr.readRole(new Role(member)); roleDns.add(role.getDn()); } group.setMembers(roleDns); } }
private void loadUserDns(Group group) throws SecurityException { if (CollectionUtils.isNotEmpty(group.getMembers())) { ReviewMgr reviewMgr = ReviewMgrFactory.createInstance(); List<String> userDns = new ArrayList<String>(); for (String member : group.getMembers()) { User user = reviewMgr.readUser(new User(member)); userDns.add(user.getDn()); } group.setMembers(userDns); } }
/** * @param le * @param sequence * @return * @throws LdapException */ private Group unloadLdapEntry(Entry le, long sequence) throws LdapInvalidAttributeValueException { Group entity = new ObjectFactory().createGroup(); entity.setName(getAttribute(le, SchemaConstants.CN_AT)); entity.setDescription(getAttribute(le, SchemaConstants.DESCRIPTION_AT)); String typeAsString = getAttribute(le, GlobalIds.TYPE); if (StringUtils.isNotEmpty(typeAsString)) { entity.setType(Group.Type.valueOf(typeAsString.toUpperCase())); } entity.setProtocol(getAttribute(le, GROUP_PROTOCOL_ATTR_IMPL)); entity.setMembers(getAttributes(le, SchemaConstants.MEMBER_AT)); entity.setMemberDn(true); entity.setProperties(PropUtil.getProperties(getAttributes(le, GROUP_PROPERTY_ATTR_IMPL), '=')); entity.setSequenceId(sequence); return entity; }