Search in sources :

Example 6 with AttributeRemovedForUser

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

the class AttributesManagerBlImpl method removeAttributeWithoutCheck.

@Override
public boolean removeAttributeWithoutCheck(PerunSession sess, User user, AttributeDefinition attribute) throws WrongAttributeAssignmentException {
    getAttributesManagerImpl().checkNamespace(sess, attribute, NS_USER_ATTR);
    if (getAttributesManagerImpl().isCoreAttribute(sess, attribute))
        throw new WrongAttributeAssignmentException(attribute);
    boolean changed = getAttributesManagerImpl().removeAttribute(sess, user, attribute);
    if (changed) {
        try {
            getAttributesManagerImpl().changedAttributeHook(sess, user, new Attribute(attribute));
        } catch (WrongReferenceAttributeValueException ex) {
            throw new InternalErrorException(ex);
        }
        log.info("{} removed attribute {} from  user {}.", sess.getLogId(), attribute.getName(), user.getId());
        getPerunBl().getAuditer().log(sess, new AttributeRemovedForUser(new AttributeDefinition(attribute), user));
    }
    return changed;
}
Also used : Attribute(cz.metacentrum.perun.core.api.Attribute) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) WrongAttributeAssignmentException(cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException) WrongReferenceAttributeValueException(cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException) AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition) InternalErrorException(cz.metacentrum.perun.core.api.exceptions.InternalErrorException) AttributeRemovedForUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForUser)

Example 7 with AttributeRemovedForUser

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

the class urn_perun_user_attribute_def_virt_tcsMails_muTest method resolveVirtualAttributeValueChangeRemoved3.

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

Example 8 with AttributeRemovedForUser

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

the class urn_perun_user_attribute_def_virt_tcsMails_muTest method resolveVirtualAttributeValueChangeRemoved4.

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

Aggregations

AttributeRemovedForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForUser)8 AuditEvent (cz.metacentrum.perun.audit.events.AuditEvent)7 Test (org.junit.Test)5 Attribute (cz.metacentrum.perun.core.api.Attribute)3 AttributeDefinition (cz.metacentrum.perun.core.api.AttributeDefinition)3 AllAttributesRemovedForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForUser)2 AttributeChangedForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeChangedForUser)2 AttributeSetForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUser)2 ArrayList (java.util.ArrayList)2 AllAttributesRemovedForGroup (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForGroup)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 RichAttribute (cz.metacentrum.perun.core.api.RichAttribute)1 User (cz.metacentrum.perun.core.api.User)1 AttributeNotExistsException (cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException)1