use of org.springframework.ldap.core.DirContextOperations in project perun by CESNET.
the class PerunGroupImpl method synchronizeResources.
@Override
public void synchronizeResources(Group group, List<Resource> resources) {
DirContextOperations groupEntry = findByDN(buildDN(group));
doSynchronizeResources(groupEntry, resources);
ldapTemplate.modifyAttributes(groupEntry);
}
use of org.springframework.ldap.core.DirContextOperations in project perun by CESNET.
the class PerunGroupImpl method removeMemberFromGroup.
public void removeMemberFromGroup(Member member, Group group) {
// Remove member from 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.removeAttributeValue(PerunAttribute.PerunAttributeNames.ldapAttrUniqueMember, fullMemberDN.toString());
ldapTemplate.modifyAttributes(groupEntry);
// Remove member from vo if this group is membersGroup
if (group.getName().equals(VosManager.MEMBERS_GROUP) && group.getParentGroupId() == null) {
// Remove info from vo
vo.removeMemberFromVO(group.getVoId(), member);
}
// Remove group info from member
DirContextOperations userEntry = findByDN(memberDN);
userEntry.removeAttributeValue(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 removeFromGroupAdmins.
@Override
public void removeFromGroupAdmins(Group group, Group group2) {
DirContextOperations entry = findByDN(buildDN(group));
Name groupDN = addBaseDN(getEntryDN(String.valueOf(group2.getVoId()), String.valueOf(group2.getId())));
entry.removeAttributeValue(PerunAttribute.PerunAttributeNames.ldapAttrAdminOfGroup, groupDN.toString());
ldapTemplate.modifyAttributes(entry);
}
use of org.springframework.ldap.core.DirContextOperations in project perun by CESNET.
the class PerunUserImpl method addAsFacilityAdmin.
@Override
public void addAsFacilityAdmin(User user, Facility facility) {
DirContextOperations entry = findByDN(buildDN(user));
Name facilityDN = addBaseDN(perunFacility.getEntryDN(String.valueOf(facility.getId())));
entry.addAttributeValue(PerunAttribute.PerunAttributeNames.ldapAttrAdminOfFacility, facilityDN.toString());
ldapTemplate.modifyAttributes(entry);
}
use of org.springframework.ldap.core.DirContextOperations in project perun by CESNET.
the class PerunUserImpl method addAsVoAdmin.
@Override
public void addAsVoAdmin(User user, Vo vo) {
DirContextOperations entry = findByDN(buildDN(user));
Name voDN = addBaseDN(perunVO.getEntryDN(String.valueOf(vo.getId())));
entry.addAttributeValue(PerunAttribute.PerunAttributeNames.ldapAttrAdminOfVo, voDN.toString());
ldapTemplate.modifyAttributes(entry);
}
Aggregations