use of cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForMemberAndGroup in project perun by CESNET.
the class AttributesManagerBlImpl method setAttributeWithoutCheck.
@Override
public boolean setAttributeWithoutCheck(PerunSession sess, Member member, Group group, Attribute attribute, boolean workWithUserAttributes) throws WrongAttributeAssignmentException, WrongAttributeValueException, WrongReferenceAttributeValueException, MemberGroupMismatchException {
this.checkMemberIsFromTheSameVoLikeGroup(sess, member, group);
if (getAttributesManagerImpl().isCoreAttribute(sess, attribute))
throw new WrongAttributeAssignmentException(attribute);
boolean changed;
if (getAttributesManagerImpl().isFromNamespace(attribute, AttributesManager.NS_MEMBER_GROUP_ATTR)) {
if (getAttributesManagerImpl().isVirtAttribute(sess, attribute)) {
changed = getAttributesManagerImpl().setVirtualAttribute(sess, member, group, attribute);
} else {
changed = getAttributesManagerImpl().setAttribute(sess, member, group, attribute);
if (changed) {
getPerunBl().getAuditer().log(sess, new AttributeSetForMemberAndGroup(attribute, member, group));
getAttributesManagerImpl().changedAttributeHook(sess, member, group, attribute);
}
}
} else if (workWithUserAttributes) {
if (getAttributesManagerImpl().isFromNamespace(attribute, AttributesManager.NS_USER_ATTR)) {
User user = getPerunBl().getUsersManagerBl().getUserByMember(sess, member);
if (getAttributesManagerImpl().isVirtAttribute(sess, attribute)) {
changed = getAttributesManagerImpl().setVirtualAttribute(sess, user, attribute);
} else {
changed = setAttributeWithoutCheck(sess, user, attribute);
}
} else if (getAttributesManagerImpl().isFromNamespace(attribute, AttributesManager.NS_MEMBER_ATTR)) {
if (getAttributesManagerImpl().isVirtAttribute(sess, attribute)) {
changed = getAttributesManagerImpl().setVirtualAttribute(sess, member, attribute);
} else {
changed = setAttributeWithoutCheck(sess, member, attribute);
}
} else {
throw new WrongAttributeAssignmentException(attribute);
}
} else {
throw new WrongAttributeAssignmentException(attribute);
}
return changed;
}
Aggregations