use of cz.metacentrum.perun.core.api.exceptions.NotSpecificUserExpectedException in project perun by CESNET.
the class UsersManagerEntry method removeSpecificUserOwner.
@Override
public void removeSpecificUserOwner(PerunSession sess, User user, User specificUser) throws UserNotExistsException, PrivilegeException, SpecificUserExpectedException, NotSpecificUserExpectedException, RelationNotExistsException, SpecificUserOwnerAlreadyRemovedException {
Utils.checkPerunSession(sess);
getUsersManagerBl().checkUserExists(sess, user);
getUsersManagerBl().checkUserExists(sess, specificUser);
if (user.isServiceUser())
throw new NotSpecificUserExpectedException(user);
if (user.isSponsoredUser() && specificUser.isSponsoredUser())
throw new NotSpecificUserExpectedException(specificUser);
if (!specificUser.isSpecificUser())
throw new SpecificUserExpectedException(specificUser);
// Authorization
if (!AuthzResolver.authorizedInternal(sess, "removeSpecificUserOwner_User_User_policy", specificUser) && !AuthzResolver.authorizedInternal(sess, "owner-removeSpecificUserOwner_User_User_policy", user)) {
throw new PrivilegeException(sess, "removeSpecificUserOwner");
}
getUsersManagerBl().removeSpecificUserOwner(sess, user, specificUser);
}
use of cz.metacentrum.perun.core.api.exceptions.NotSpecificUserExpectedException in project perun by CESNET.
the class UsersManagerEntry method addSpecificUserOwner.
@Override
public void addSpecificUserOwner(PerunSession sess, User user, User specificUser) throws UserNotExistsException, PrivilegeException, SpecificUserExpectedException, NotSpecificUserExpectedException, RelationExistsException {
Utils.checkPerunSession(sess);
getUsersManagerBl().checkUserExists(sess, user);
getUsersManagerBl().checkUserExists(sess, specificUser);
if (user.isServiceUser())
throw new NotSpecificUserExpectedException(user);
if (user.isSponsoredUser() && specificUser.isSponsoredUser())
throw new NotSpecificUserExpectedException(specificUser);
if (!specificUser.isSpecificUser())
throw new SpecificUserExpectedException(specificUser);
// Authorization
if (!AuthzResolver.authorizedInternal(sess, "addSpecificUserOwner_User_User_policy", specificUser) && !AuthzResolver.authorizedInternal(sess, "owner-addSpecificUserOwner_User_User_policy", user)) {
throw new PrivilegeException(sess, "addSpecificUserOwner");
}
getUsersManagerBl().addSpecificUserOwner(sess, user, specificUser);
}
use of cz.metacentrum.perun.core.api.exceptions.NotSpecificUserExpectedException in project perun by CESNET.
the class UsersManagerEntry method getSpecificUsersByUser.
@Override
public List<User> getSpecificUsersByUser(PerunSession sess, User user) throws UserNotExistsException, PrivilegeException, NotSpecificUserExpectedException {
Utils.checkPerunSession(sess);
getUsersManagerBl().checkUserExists(sess, user);
if (user.isServiceUser())
throw new NotSpecificUserExpectedException(user);
List<Vo> vos = getUsersManagerBl().getVosWhereUserIsMember(sess, user);
for (Vo vo : vos) {
if (!AuthzResolver.authorizedInternal(sess, "getSpecificUsersByUser_User_policy", Arrays.asList(user, vo))) {
throw new PrivilegeException(sess, "getSpecificUsersByUser");
}
}
return getUsersManagerBl().getSpecificUsersByUser(sess, user);
}
Aggregations