use of cz.metacentrum.perun.audit.events.UserManagerEvents.UserExtSourceRemovedFromUser in project perun by CESNET.
the class UsersManagerBlImpl method removeUserExtSource.
@Override
public void removeUserExtSource(PerunSession sess, User user, UserExtSource userExtSource) throws UserExtSourceAlreadyRemovedException {
// First remove all user extSource attributes before removing userExtSource
try {
getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, userExtSource);
} catch (WrongReferenceAttributeValueException | WrongAttributeValueException ex) {
throw new InternalErrorException("Can't remove userExtSource because there is problem with removing all it's attributes.", ex);
}
getUsersManagerImpl().removeUserExtSource(sess, user, userExtSource);
getPerunBl().getAuditer().log(sess, new UserExtSourceRemovedFromUser(userExtSource, user));
}
use of cz.metacentrum.perun.audit.events.UserManagerEvents.UserExtSourceRemovedFromUser in project perun by CESNET.
the class urn_perun_user_attribute_def_virt_loa method resolveVirtualAttributeValueChange.
@Override
public List<AuditEvent> resolveVirtualAttributeValueChange(PerunSessionImpl sess, AuditEvent message) throws AttributeNotExistsException, WrongAttributeAssignmentException {
List<AuditEvent> resolvingMessages = new ArrayList<>();
if (message == null)
return resolvingMessages;
User user = null;
try {
if (message instanceof UserExtSourceAddedToUser) {
user = ((UserExtSourceAddedToUser) message).getUser();
sess.getPerunBl().getUsersManagerBl().checkUserExists(sess, user);
resolvingMessages.add(resolveEvent(sess, user));
} else if (message instanceof UserExtSourceRemovedFromUser) {
user = ((UserExtSourceRemovedFromUser) message).getUser();
sess.getPerunBl().getUsersManagerBl().checkUserExists(sess, user);
resolvingMessages.add(resolveEvent(sess, user));
} else if (message instanceof UserExtSourceUpdated) {
resolvingMessages.add(resolveEvent(sess, sess.getPerunBl().getUsersManagerBl().getUserById(sess, ((UserExtSourceUpdated) message).getUserExtSource().getUserId())));
}
} catch (UserNotExistsException e) {
log.warn("User {} associated with event {} no longer exists while resolving virtual attribute value change for LoA.", user, message.getName());
}
return resolvingMessages;
}
Aggregations