@Test public void testIsAdmin() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException { AuthorizableWrapper authWrapper = new AuthorizableWrapperImpl(userResource); assertFalse(authWrapper.isAdministrator()); authWrapper = new AuthorizableWrapperImpl(adminResource); assertTrue(authWrapper.isAdministrator()); authWrapper = new AuthorizableWrapperImpl(throwyResource); assertFalse(authWrapper.isAdministrator()); }
@Override public boolean isAdministrator() { try { return !authorizable.isGroup() && ("admin".equals(authorizable.getID()) || isMember("administrators")); } catch (RepositoryException e) { log.error("Failed to check if authorizable is an administrator", e); return false; } }
AuthorizableWrapperImpl implements AuthorizableWrapper { @Override public boolean isAdministrator() { try { return !authorizable.isGroup() && ("admin".equals(authorizable.getID()) || isMember("administrators")); } catch (RepositoryException e) { log.error("Failed to check if authorizable is an administrator", e); return false; } } }
AuthorizableWrapperImpl implements AuthorizableWrapper { @Override public boolean isAdministrator() { try { return !authorizable.isGroup() && ("admin".equals(authorizable.getID()) || isMember("administrators")); } catch (RepositoryException e) { log.error("Failed to check if authorizable is an administrator", e); return false; } } AuthorizableWrapperImpl(ResourceResolver resolver);  AuthorizableWrapperImpl(Resource resource); }
AuthorizableWrapperImpl implements AuthorizableWrapper { @Override public boolean isAdministrator() { try { return !authorizable.isGroup() && ("admin".equals(authorizable.getID()) || isMember("administrators")); } catch (RepositoryException e) { log.error("Failed to check if authorizable is an administrator", e); return false; } } AuthorizableWrapperImpl(ResourceResolver resolver);  AuthorizableWrapperImpl(Resource resource); @Override Authorizable getAuthorizable(); @Override Iterator<Authorizable> getDeclaredMembers(); @Override Iterator<Group> getDeclaredMembership(); @Override Iterator<String> getGroupNames(); @Override String getId(); @Override Iterator<Authorizable> getMembers(); @Override Iterator<Group> getMembership(); @Override boolean isAdministrator(); @Override boolean isMember(String groupName); }
AuthorizableWrapperImpl implements AuthorizableWrapper { @Override public boolean isAdministrator() { try { return !authorizable.isGroup() && ("admin".equals(authorizable.getID()) || isMember("administrators")); } catch (RepositoryException e) { log.error("Failed to check if authorizable is an administrator", e); return false; } } AuthorizableWrapperImpl(ResourceResolver resolver);  AuthorizableWrapperImpl(Resource resource); @Override Authorizable getAuthorizable(); @Override Iterator<Authorizable> getDeclaredMembers(); @Override Iterator<Group> getDeclaredMembership(); @Override Iterator<String> getGroupNames(); @Override String getId(); @Override Iterator<Authorizable> getMembers(); @Override Iterator<Group> getMembership(); @Override boolean isAdministrator(); @Override boolean isMember(String groupName);  }