Search in sources :

Example 6 with AlreadyAdminException

use of cz.metacentrum.perun.core.api.exceptions.AlreadyAdminException in project perun by CESNET.

the class FacilitiesManagerBlImpl method addAdmin.

@Override
public void addAdmin(PerunSession sess, Facility facility, Group group) throws InternalErrorException, AlreadyAdminException {
    List<Group> listOfAdmins = getAdminGroups(sess, facility);
    if (listOfAdmins.contains(group))
        throw new AlreadyAdminException(group);
    AuthzResolverBlImpl.setRole(sess, group, facility, Role.FACILITYADMIN);
    getPerunBl().getAuditer().log(sess, "Group {} was added as admin of {}.", group, facility);
}
Also used : Group(cz.metacentrum.perun.core.api.Group) ContactGroup(cz.metacentrum.perun.core.api.ContactGroup) AlreadyAdminException(cz.metacentrum.perun.core.api.exceptions.AlreadyAdminException)

Aggregations

AlreadyAdminException (cz.metacentrum.perun.core.api.exceptions.AlreadyAdminException)6 Group (cz.metacentrum.perun.core.api.Group)3 ConsistencyErrorException (cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException)3 User (cz.metacentrum.perun.core.api.User)2 ContactGroup (cz.metacentrum.perun.core.api.ContactGroup)1 RichUser (cz.metacentrum.perun.core.api.RichUser)1 FacilityExistsException (cz.metacentrum.perun.core.api.exceptions.FacilityExistsException)1 FacilityNotExistsException (cz.metacentrum.perun.core.api.exceptions.FacilityNotExistsException)1 GroupExistsException (cz.metacentrum.perun.core.api.exceptions.GroupExistsException)1 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)1