use of cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeChangedForResourceAndMember in project perun by CESNET.
the class urn_perun_member_resource_attribute_def_virt_isBanned method resolveBanChangedForResource.
private List<AuditEvent> resolveBanChangedForResource(PerunSessionImpl perunSession, int memberId, int resourceId) throws AttributeNotExistsException {
List<AuditEvent> resolvingMessages = new ArrayList<>();
try {
Member member = perunSession.getPerunBl().getMembersManagerBl().getMemberById(perunSession, memberId);
Resource resource = perunSession.getPerunBl().getResourcesManagerBl().getResourceById(perunSession, resourceId);
AttributeDefinition attributeDefinition = perunSession.getPerunBl().getAttributesManagerBl().getAttributeDefinition(perunSession, A_MR_V_isBanned);
resolvingMessages.add(new AttributeChangedForResourceAndMember(new Attribute(attributeDefinition), resource, member));
} catch (MemberNotExistsException | ResourceNotExistsException 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.AttributesManagerEvents.AttributeChangedForResourceAndMember 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;
}
Aggregations