@NotNull @Override public Boolean perform() { return delegate.isGroup(); } });
@NotNull @Override public Boolean perform() { return delegate.isGroup(); } });
@Nonnull @Override public Boolean perform() { return delegate.isGroup(); } });
@Nullable Authorizable wrap(@Nullable Authorizable authorizable) { if (authorizable == null) { return null; } if (authorizable.isGroup()) { return wrap((Group) authorizable); } else { return wrap((User) authorizable); } }
@Nullable Authorizable wrap(@Nullable Authorizable authorizable) { if (authorizable == null) { return null; } if (authorizable.isGroup()) { return wrap((Group) authorizable); } else { return wrap((User) authorizable); } }
@CheckForNull Authorizable wrap(@Nullable Authorizable authorizable) { if (authorizable == null) { return null; } if (authorizable.isGroup()) { return wrap((Group) authorizable); } else { return wrap((User) authorizable); } }
@Override @Nullable org.apache.jackrabbit.api.security.user.Group getGroup() throws RepositoryException { if (group == null) { Authorizable authorizable = getUserManager().getAuthorizable(this); if (authorizable != null && authorizable.isGroup()) { group = (org.apache.jackrabbit.api.security.user.Group) authorizable; } } return group; } }
@Override @CheckForNull org.apache.jackrabbit.api.security.user.Group getGroup() throws RepositoryException { if (group == null) { Authorizable authorizable = getUserManager().getAuthorizable(this); if (authorizable != null && authorizable.isGroup()) { group = (org.apache.jackrabbit.api.security.user.Group) authorizable; } } return group; } }
private Set<Principal> getGroupPrincipals(@Nullable Authorizable authorizable) throws RepositoryException { if (authorizable != null && !authorizable.isGroup()) { Tree userTree = root.getTree(authorizable.getPath()); return getGroupPrincipals(userTree); } else { return ImmutableSet.of(); } }
GroupPredicate(UserManager userManager, String groupId, boolean declaredMembersOnly) throws RepositoryException { Authorizable authorizable = userManager.getAuthorizable(groupId); Group group = (authorizable == null || !authorizable.isGroup()) ? null : (Group) authorizable; if (group != null) { membersIterator = (declaredMembersOnly) ? group.getDeclaredMembers() : group.getMembers(); } else { membersIterator = Collections.emptyIterator(); } }
@Nullable private User getUser(@NotNull Tree tokenTree) throws RepositoryException { String userPath = Text.getRelativeParent(tokenTree.getPath(), 2); Authorizable authorizable = userManager.getAuthorizableByPath(userPath); if (authorizable != null && !authorizable.isGroup() && !((User) authorizable).isDisabled()) { return (User) authorizable; } else { return null; } }
@Override @Nullable org.apache.jackrabbit.api.security.user.Group getGroup() throws RepositoryException { if (group == null) { Authorizable authorizable = getUserManager().getAuthorizable(new PrincipalImpl(getName())); if (authorizable != null && authorizable.isGroup()) { group = (org.apache.jackrabbit.api.security.user.Group) authorizable; } } return group; } }
public void testFindAllGroups() throws RepositoryException { Iterator<Authorizable> it = userMgr.findAuthorizables(pPrincipalName, null, UserManager.SEARCH_TYPE_GROUP); while (it.hasNext()) { assertTrue(it.next().isGroup()); } }
public void testFindAllUsers() throws RepositoryException { Iterator<Authorizable> it = userMgr.findAuthorizables(pPrincipalName, null, UserManager.SEARCH_TYPE_USER); while (it.hasNext()) { assertFalse(it.next().isGroup()); } }
@Test public void testFindAllUsersDoesNotContainGroup() throws RepositoryException { Iterator<Authorizable> it = userMgr.findAuthorizables(UserConstants.REP_PRINCIPAL_NAME, null, UserManager.SEARCH_TYPE_USER); while (it.hasNext()) { assertFalse(it.next().isGroup()); } }
protected User getTestUser(Session session) throws NotExecutableException, RepositoryException { Authorizable auth = getUserManager(session).getAuthorizable(session.getUserID()); if (auth != null && !auth.isGroup()) { return (User) auth; } // should never happen. An Session should always have a corresponding User. throw new NotExecutableException("Unable to retrieve a User."); }
protected User getTestUser(Session session) throws NotExecutableException, RepositoryException { Authorizable auth = getUserManager(session).getAuthorizable(session.getUserID()); if (auth != null && !auth.isGroup()) { return (User) auth; } // should never happen. An Session should always have a corresponding User. throw new NotExecutableException("Unable to retrieve a User."); }
public void testGetPrincipal() throws RepositoryException { Authorizable admin = userMgr.getAuthorizable(adminId); assertNotNull(admin); assertFalse(admin.isGroup()); assertTrue(admin.getPrincipal() instanceof AdminPrincipal); }
public void testGroupByIdAndType() throws Exception { Group testGroup = createTestGroup(); Group gr = userMgr.getAuthorizable(testGroup.getID(), Group.class); assertEquals("Equal ID expected", testGroup.getID(), gr.getID()); Authorizable auth2 = userMgr.getAuthorizable(testGroup.getID(), testGroup.getClass()); assertEquals("Equal ID expected", testGroup.getID(), auth2.getID()); assertTrue(auth2.isGroup()); auth2 = userMgr.getAuthorizable(testGroup.getID(), Authorizable.class); assertEquals("Equal ID expected", testGroup.getID(), auth2.getID()); assertTrue(auth2.isGroup()); }
@Test public void testGetUserByPrincipal() throws Exception { user = createUser(uid); Authorizable authorizable = userMgr.getAuthorizable(user.getPrincipal()); assertNotNull(authorizable); assertFalse(authorizable.isGroup()); assertFalse(((User) authorizable).isAdmin()); assertTrue(((User) authorizable).isSystemUser()); }