/** * Determine the light administrator privileges associated with a session. * If the session originates via <q>sudo</q>, takes that into account. * Does <em>not</em> take account of if the relevant user is a member of <tt>system</tt>: * calculates assuming that the user is an administrator. * Assumes that <tt>root</tt> has all light administrator privileges. * @param session an OMERO session * @return the light administrator privileges associated with the session */ private ImmutableSet<AdminPrivilege> getPrivileges(Session session) { final Set<AdminPrivilege> privileges = new HashSet<>(getAllPrivileges()); removeUserPrivileges(session.getSudoer(), privileges); removeUserPrivileges(session.getOwner(), privileges); return ImmutableSet.copyOf(privileges); }