/** * Is the authenticated user a member of the given group or one of its sub groups? * * @param group * @return */ public boolean isUserInGroup(SwordContext swordContext, Group group) { EPerson authenticated = swordContext.getAuthenticated(); if (authenticated != null) { return isInGroup(group, authenticated); } return false; }
/** * Is the authenticated user a DSpace administrator? This translates as asking the question of * whether the given eperson is a member of the special DSpace group Administrator, with id 1 * * @param swordContext * @return true if administrator, false if not * @throws java.sql.SQLException */ public boolean isUserAdmin(SwordContext swordContext) throws DSpaceSwordException { try { EPerson authenticated = swordContext.getAuthenticated(); if (authenticated != null) { return AuthorizeManager.isAdmin(swordContext.getAuthenticatorContext()); } return false; } catch (SQLException e) { log.error("Caught exception: ", e); throw new DSpaceSwordException(e); } }