use of cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUes in project perun by CESNET.
the class urn_perun_user_attribute_def_virt_institutionsCountriesTest method resolveVirtualAttributeValueChange.
@Test
public void resolveVirtualAttributeValueChange() throws Exception {
setSchacHomeOrgs("muni.cz;cesnet.cz");
AttributeDefinition countries = classInstance.getAttributeDefinition();
when(sess.getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, "urn:perun:user:attribute-def:virt:institutionsCountries")).thenReturn(countries);
when(sess.getPerunBl().getUsersManagerBl().getUserById(sess, userExtSource.getUserId())).thenReturn(user);
AuditEvent uesSet = new AttributeSetForUes(schacHomeOrg, userExtSource);
List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, uesSet);
assertTrue("audit should contain change of institutionsCountries", msgs.get(0).getMessage().contains("friendlyName=<institutionsCountries>"));
}
use of cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUes in project perun by CESNET.
the class AttributesManagerBlImpl method setAttributeWithoutCheck.
private boolean setAttributeWithoutCheck(PerunSession sess, UserExtSource ues, Attribute attribute) throws WrongAttributeAssignmentException, WrongAttributeValueException {
getAttributesManagerImpl().checkNamespace(sess, attribute, AttributesManager.NS_UES_ATTR);
if (getAttributesManagerImpl().isCoreAttribute(sess, attribute))
throw new WrongAttributeAssignmentException(attribute);
boolean changed;
if (isVirtAttribute(sess, attribute)) {
return getAttributesManagerImpl().setVirtualAttribute(sess, ues, attribute);
} else {
changed = getAttributesManagerImpl().setAttribute(sess, ues, attribute);
}
if (changed) {
getPerunBl().getAuditer().log(sess, new AttributeSetForUes(attribute, ues));
getAttributesManagerImpl().changedAttributeHook(sess, ues, attribute);
}
return changed;
}
Aggregations