use of org.springframework.ldap.core.DirContextOperations in project perun by CESNET.
the class PerunGroupImpl method removeFromFacilityAdmins.
@Override
public void removeFromFacilityAdmins(Group group, Facility facility) {
DirContextOperations entry = findByDN(buildDN(group));
Name facilityDN = addBaseDN(perunFacility.getEntryDN(String.valueOf(facility.getId())));
entry.removeAttributeValue(PerunAttribute.PerunAttributeNames.ldapAttrAdminOfFacility, facilityDN.toString());
ldapTemplate.modifyAttributes(entry);
}
use of org.springframework.ldap.core.DirContextOperations in project perun by CESNET.
the class PerunGroupImpl method addAsVoAdmin.
@Override
public void addAsVoAdmin(Group group, Vo vo) {
DirContextOperations entry = findByDN(buildDN(group));
Name voDN = addBaseDN(perunVO.getEntryDN(String.valueOf(vo.getId())));
entry.addAttributeValue(PerunAttribute.PerunAttributeNames.ldapAttrAdminOfVo, voDN.toString());
ldapTemplate.modifyAttributes(entry);
}
use of org.springframework.ldap.core.DirContextOperations in project perun by CESNET.
the class PerunGroupImpl method removeGroup.
public void removeGroup(Group group) {
Name groupDN = buildDN(group);
Name fullGroupDN = this.addBaseDN(groupDN);
DirContextOperations groupEntry = findByDN(groupDN);
String[] uniqueMembers = groupEntry.getStringAttributes(PerunAttribute.PerunAttributeNames.ldapAttrUniqueMember);
if (uniqueMembers != null)
for (String memberDN : uniqueMembers) {
DirContextOperations memberEntry = user.findByDN(LdapNameBuilder.newInstance(memberDN).build());
memberEntry.removeAttributeValue(PerunAttribute.PerunAttributeNames.ldapAttrMemberOf, fullGroupDN.toString());
ldapTemplate.modifyAttributes(memberEntry);
}
deleteEntry(group);
}
use of org.springframework.ldap.core.DirContextOperations in project perun by CESNET.
the class PerunGroupImpl method addMemberToGroup.
public void addMemberToGroup(Member member, Group group) {
// Add member to group
Name groupDN = buildDN(group);
DirContextOperations groupEntry = findByDN(groupDN);
Name memberDN = user.getEntryDN(String.valueOf(member.getUserId()));
Name fullMemberDN = addBaseDN(memberDN);
if (isMember(groupEntry, fullMemberDN))
return;
groupEntry.addAttributeValue(PerunAttribute.PerunAttributeNames.ldapAttrUniqueMember, fullMemberDN.toString());
ldapTemplate.modifyAttributes(groupEntry);
// Add member to vo if this group is membersGroup
if (group.getName().equals(VosManager.MEMBERS_GROUP) && group.getParentGroupId() == null) {
// Add info to vo
vo.addMemberToVO(group.getVoId(), member);
}
// Add group info to member
// user->add('memberOf' => groupDN)
DirContextOperations userEntry = findByDN(memberDN);
userEntry.addAttributeValue(PerunAttribute.PerunAttributeNames.ldapAttrMemberOf, addBaseDN(groupDN).toString());
ldapTemplate.modifyAttributes(userEntry);
}
use of org.springframework.ldap.core.DirContextOperations in project perun by CESNET.
the class PerunGroupImpl method synchronizeAdminRoles.
@Override
public void synchronizeAdminRoles(Group group, List<Group> admin_groups, List<Vo> admin_vos, List<Facility> admin_facilities) {
DirContextOperations groupEntry = findByDN(buildDN(group));
doSynchronizeAdminRoles(groupEntry, admin_groups, admin_vos, admin_facilities);
ldapTemplate.modifyAttributes(groupEntry);
}
Aggregations