use of cz.metacentrum.perun.audit.events.SecurityTeamsManagerEvents.SecurityTeamCreated in project perun by CESNET.
the class SecurityTeamsManagerBlImpl method createSecurityTeam.
@Override
public SecurityTeam createSecurityTeam(PerunSession sess, SecurityTeam securityTeam) {
securityTeam = getSecurityTeamsManagerImpl().createSecurityTeam(sess, securityTeam);
getPerunBl().getAuditer().log(sess, new SecurityTeamCreated(securityTeam));
// set creator as security team admin
User user = sess.getPerunPrincipal().getUser();
if (user != null) {
// user can be null in tests
try {
AuthzResolverBlImpl.setRole(sess, user, securityTeam, Role.SECURITYADMIN);
} catch (AlreadyAdminException e) {
throw new ConsistencyErrorException("Newly created securityTeam already have an admin.", e);
} catch (RoleCannotBeManagedException e) {
throw new InternalErrorException(e);
}
}
return securityTeam;
}
Aggregations