use of org.springframework.ldap.NamingException in project kylo by Teradata.
the class LdapGroupList method getAllGroups.
public void getAllGroups(LdapTemplate ldapTemplate, String groupBaseDnPattern) {
try {
groupInfo = new ArrayList<>();
LdapQuery query = query().base(groupBaseDnPattern);
groupInfo = ldapTemplate.list(query.base());
} catch (NamingException e) {
log.error("Unable to Groups from LDAP " + e.getMessage());
throw new RuntimeException(e);
}
}
use of org.springframework.ldap.NamingException in project perun by CESNET.
the class GroupEventProcessor method processMemberValidated.
public void processMemberValidated(String msg, MessageBeans beans) {
if (beans.getMember() == null) {
return;
}
List<Group> memberGroups = new ArrayList<Group>();
Perun perun = ldapcManager.getPerunBl();
try {
log.debug("Getting list of groups for member {}", beans.getMember().getId());
// memberGroups = Rpc.GroupsManager.getAllMemberGroups(ldapcManager.getRpcCaller(), beans.getMember());
memberGroups = perun.getGroupsManager().getAllGroupsWhereMemberIsActive(ldapcManager.getPerunSession(), beans.getMember());
for (Group g : memberGroups) {
log.debug("Adding validated member {} to group {}", beans.getMember(), g);
perunGroup.addMemberToGroup(beans.getMember(), g);
}
} catch (MemberNotExistsException e) {
// IMPORTANT this is not problem, if member not exist, we expected that will be deleted in some message after that, in DB is deleted
} catch (PrivilegeException e) {
log.warn("There are no privileges for getting member's groups", e);
} catch (NamingException | InternalErrorException e) {
log.error("Error adding validated member to group", e);
}
}
use of org.springframework.ldap.NamingException in project perun by CESNET.
the class ResourceAttributeProcessor method processVirtualAttributeChanged.
public void processVirtualAttributeChanged(String msg, MessageBeans beans) {
PerunBl perun = (PerunBl) ldapcManager.getPerunBl();
if (beans.getAttribute() == null || beans.getResource() == null) {
return;
}
try {
Attribute virtAttr = perun.getAttributesManagerBl().getAttribute(ldapcManager.getPerunSession(), beans.getResource(), beans.getAttribute().getName());
log.debug("Changing virtual attribute {} for resource {}", virtAttr, beans.getResource());
perunResource.modifyEntry(beans.getResource(), virtAttr);
} catch (InternalErrorException | AttributeNotExistsException | WrongAttributeAssignmentException | NamingException e) {
log.error("Error changing virtual attribute:", e);
}
}
use of org.springframework.ldap.NamingException in project perun by CESNET.
the class UserAttributeProcessor method processAdminAdded.
public void processAdminAdded(String msg, MessageBeans beans) {
if (beans.getUser() == null) {
return;
}
PerunBean admined = null;
try {
if (beans.getVo() != null) {
admined = beans.getVo();
perunUser.addAsVoAdmin(beans.getUser(), beans.getVo());
} else if (beans.getGroup() != null) {
admined = beans.getGroup();
perunUser.addAsGroupAdmin(beans.getUser(), beans.getGroup());
} else if (beans.getFacility() != null) {
admined = beans.getFacility();
perunUser.addAsFacilityAdmin(beans.getUser(), beans.getFacility());
}
} catch (NamingException | InternalErrorException e) {
log.error("Error adding user {} as admin of {}: {}", beans.getUser().getId(), admined.getId(), ((InvalidAttributeValueException) e).getExplanation(), e);
}
}
use of org.springframework.ldap.NamingException in project perun by CESNET.
the class UserAttributeProcessor method processAdminRemoved.
public void processAdminRemoved(String msg, MessageBeans beans) {
if (beans.getUser() == null) {
return;
}
PerunBean admined = null;
try {
if (beans.getVo() != null) {
admined = beans.getVo();
perunUser.removeFromVoAdmins(beans.getUser(), beans.getVo());
} else if (beans.getGroup() != null) {
admined = beans.getGroup();
perunUser.removeFromGroupAdmins(beans.getUser(), beans.getGroup());
} else if (beans.getFacility() != null) {
admined = beans.getFacility();
perunUser.removeFromFacilityAdmins(beans.getUser(), beans.getFacility());
}
} catch (NamingException | InternalErrorException e) {
log.error("Error removing user {} from admins of {}: {}", beans.getUser().getId(), admined.getId(), e);
}
}
Aggregations