use of cz.metacentrum.perun.core.api.exceptions.PrivilegeException in project perun by CESNET.
the class AuthzResolver method unsetRole.
/**
* Unset role for user and <b>one</b> complementary object.
*
* If complementary object is wrong for the role, throw an exception.
* For role "perunadmin" ignore complementary object.
*
* @param sess perun session
* @param user the user for unsetting role
* @param role role of user in a session
* @param complementaryObject object for which role will be unset
*
* @throws InternalErrorException
* @throws PrivilegeException
* @throws UserNotExistsException
* @throws UserNotAdminException
*/
public static void unsetRole(PerunSession sess, User user, PerunBean complementaryObject, Role role) throws InternalErrorException, PrivilegeException, UserNotExistsException, UserNotAdminException {
Utils.notNull(role, "role");
((PerunBl) sess.getPerun()).getUsersManagerBl().checkUserExists(sess, user);
if (!isAuthorized(sess, Role.PERUNADMIN))
throw new PrivilegeException("You are not privileged to use this method unsetRole.");
cz.metacentrum.perun.core.blImpl.AuthzResolverBlImpl.unsetRole(sess, user, complementaryObject, role);
}
Aggregations