Search in sources :

Example 6 with AttributeSetForUser

use of cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUser in project perun by CESNET.

the class urn_perun_user_attribute_def_virt_tcsMails_mu method resolveVirtualAttributeValueChange.

@Override
public List<AuditEvent> resolveVirtualAttributeValueChange(PerunSessionImpl perunSession, AuditEvent message) throws AttributeNotExistsException {
    List<AuditEvent> resolvingMessages = new ArrayList<>();
    // handle source user attributes changes
    if (message instanceof AttributeSetForUser && isAffectedAttribute(((AttributeSetForUser) message).getAttribute().getFriendlyName())) {
        AttributeDefinition attributeDefinition = perunSession.getPerunBl().getAttributesManagerBl().getAttributeDefinition(perunSession, this.getAttributeDefinition().getName());
        resolvingMessages.add(new AttributeChangedForUser(new Attribute(attributeDefinition), ((AttributeSetForUser) message).getUser()));
    } else if (message instanceof AttributeRemovedForUser && isAffectedAttribute(((AttributeRemovedForUser) message).getAttribute().getFriendlyName())) {
        AttributeDefinition attributeDefinition = perunSession.getPerunBl().getAttributesManagerBl().getAttributeDefinition(perunSession, this.getAttributeDefinition().getName());
        resolvingMessages.add(new AttributeChangedForUser(new Attribute(attributeDefinition), ((AttributeRemovedForUser) message).getUser()));
    } else if (message instanceof AllAttributesRemovedForUser) {
        AttributeDefinition attributeDefinition = perunSession.getPerunBl().getAttributesManagerBl().getAttributeDefinition(perunSession, this.getAttributeDefinition().getName());
        resolvingMessages.add(new AttributeChangedForUser(new Attribute(attributeDefinition), ((AllAttributesRemovedForUser) message).getUser()));
    }
    return resolvingMessages;
}
Also used : Attribute(cz.metacentrum.perun.core.api.Attribute) AllAttributesRemovedForUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForUser) ArrayList(java.util.ArrayList) AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition) AuditEvent(cz.metacentrum.perun.audit.events.AuditEvent) AttributeChangedForUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeChangedForUser) AttributeRemovedForUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForUser) AttributeSetForUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUser)

Example 7 with AttributeSetForUser

use of cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUser in project perun by CESNET.

the class urn_perun_user_attribute_def_virt_tcsMails_muTest method resolveVirtualAttributeValueChangeSet4.

@Test
public void resolveVirtualAttributeValueChangeSet4() throws Exception {
    AuditEvent userSet = new AttributeSetForUser(privateMailsAttr, user);
    List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, userSet);
    assertTrue("audit should contain change of tcsMails", msgs.get(0).getMessage().contains(expectedTestOfMessage));
}
Also used : AuditEvent(cz.metacentrum.perun.audit.events.AuditEvent) AttributeSetForUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUser) Test(org.junit.Test)

Example 8 with AttributeSetForUser

use of cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUser in project perun by CESNET.

the class urn_perun_user_attribute_def_virt_tcsMails_muTest method resolveVirtualAttributeValueChangeSet5.

@Test
public void resolveVirtualAttributeValueChangeSet5() throws Exception {
    AuditEvent userSet = new AttributeSetForUser(o365MailsAttr, user);
    List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, userSet);
    assertTrue("audit should contain change of tcsMails", msgs.get(0).getMessage().contains(expectedTestOfMessage));
}
Also used : AuditEvent(cz.metacentrum.perun.audit.events.AuditEvent) AttributeSetForUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUser) Test(org.junit.Test)

Example 9 with AttributeSetForUser

use of cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUser in project perun by CESNET.

the class urn_perun_user_attribute_def_virt_tcsMails_muTest method resolveVirtualAttributeValueChangeSet2.

@Test
public void resolveVirtualAttributeValueChangeSet2() throws Exception {
    AuditEvent userSet = new AttributeSetForUser(isMailAttr, user);
    List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, userSet);
    assertTrue("audit should contain change of tcsMails", msgs.get(0).getMessage().contains(expectedTestOfMessage));
}
Also used : AuditEvent(cz.metacentrum.perun.audit.events.AuditEvent) AttributeSetForUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUser) Test(org.junit.Test)

Aggregations

AttributeSetForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUser)9 AuditEvent (cz.metacentrum.perun.audit.events.AuditEvent)8 Test (org.junit.Test)6 AllAttributesRemovedForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForUser)3 Attribute (cz.metacentrum.perun.core.api.Attribute)3 AttributeChangedForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeChangedForUser)2 AttributeRemovedForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForUser)2 AttributeDefinition (cz.metacentrum.perun.core.api.AttributeDefinition)2 ArrayList (java.util.ArrayList)2 AllAttributesRemovedForGroup (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForGroup)1 AllAttributesRemovedForUserExtSource (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForUserExtSource)1 AttributeRemovedForGroup (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForGroup)1 AttributeSetForGroup (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForGroup)1 DirectMemberAddedToGroup (cz.metacentrum.perun.audit.events.GroupManagerEvents.DirectMemberAddedToGroup)1 IndirectMemberAddedToGroup (cz.metacentrum.perun.audit.events.GroupManagerEvents.IndirectMemberAddedToGroup)1 MemberExpiredInGroup (cz.metacentrum.perun.audit.events.GroupManagerEvents.MemberExpiredInGroup)1 MemberValidatedInGroup (cz.metacentrum.perun.audit.events.GroupManagerEvents.MemberValidatedInGroup)1 Group (cz.metacentrum.perun.core.api.Group)1 User (cz.metacentrum.perun.core.api.User)1 AttributeNotExistsException (cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException)1