use of cz.metacentrum.perun.audit.events.AuditEvent in project perun by CESNET.
the class urn_perun_member_resource_attribute_def_virt_isBanned method resolveBanChangedForFacility.
private List<AuditEvent> resolveBanChangedForFacility(PerunSessionImpl perunSession, int userId, int facilityId) {
List<AuditEvent> resolvingMessages = new ArrayList<>();
try {
User user = perunSession.getPerunBl().getUsersManagerBl().getUserById(perunSession, userId);
Facility facility = perunSession.getPerunBl().getFacilitiesManagerBl().getFacilityById(perunSession, facilityId);
List<Pair<Resource, Member>> listOfAffectedObjects = getAffectedMemberResourceObjects(perunSession, user, facility);
for (Pair<Resource, Member> affectedObjects : listOfAffectedObjects) {
try {
AttributeDefinition attributeDefinition = perunSession.getPerunBl().getAttributesManagerBl().getAttributeDefinition(perunSession, A_MR_V_isBanned);
resolvingMessages.add(new AttributeChangedForResourceAndMember(new Attribute(attributeDefinition), affectedObjects.getLeft(), affectedObjects.getRight()));
} catch (AttributeNotExistsException ex) {
// This means that attribute isBanned not exists at all so we can skip this process
log.info("Virtual attribute {} not exists.", this.getClass().getSimpleName());
break;
}
}
} catch (UserNotExistsException | FacilityNotExistsException e) {
log.error("Can't resolve virtual attribute value change for " + this.getClass().getSimpleName() + " module because of exception.", e);
}
return resolvingMessages;
}
use of cz.metacentrum.perun.audit.events.AuditEvent 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));
}
use of cz.metacentrum.perun.audit.events.AuditEvent 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));
}
use of cz.metacentrum.perun.audit.events.AuditEvent in project perun by CESNET.
the class urn_perun_user_attribute_def_virt_tcsMails_muTest method resolveVirtualAttributeValueChangeRemovedAll.
@Test
public void resolveVirtualAttributeValueChangeRemovedAll() throws Exception {
AuditEvent allRemForUser = new AllAttributesRemovedForUser(user);
List<AuditEvent> msgs = classInstance.resolveVirtualAttributeValueChange(sess, allRemForUser);
assertTrue("audit should contain change of tcsMails", msgs.get(0).getMessage().contains(expectedTestOfMessage));
}
use of cz.metacentrum.perun.audit.events.AuditEvent 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));
}
Aggregations