@Override public Authorizable getAuthorizableByPath(String path) throws UnsupportedRepositoryOperationException, RepositoryException { return delegatee.getAuthorizableByPath(path); }
private User getRandomUser(UserManager uMgr) throws RepositoryException { return (User) uMgr.getAuthorizableByPath(uPaths.get(random.nextInt(numberOfUsers))); } }
private Group getRandomGroup(UserManager uMgr) throws RepositoryException { return (Group) uMgr.getAuthorizableByPath(gPaths.get(random.nextInt(GROUP_CNT))); }
@Override public Authorizable performNullable() throws RepositoryException { Authorizable authorizable = userManagerDelegate.getAuthorizableByPath(path); return AuthorizableDelegator.wrap(sessionDelegate, authorizable); } });
@Override public Authorizable performNullable() throws RepositoryException { Authorizable authorizable = userManagerDelegate.getAuthorizableByPath(path); return AuthorizableDelegator.wrap(sessionDelegate, authorizable); } });
@Override public Authorizable performNullable() throws RepositoryException { Authorizable authorizable = userManagerDelegate.getAuthorizableByPath(path); return AuthorizableDelegator.wrap(sessionDelegate, authorizable); } });
@Override public Authorizable getAuthorizableByPath(final String path) throws RepositoryException { Authorizable internal = delegate.getAuthorizableByPath(path); return AuthorizableFacade.ensureBestWrapper(internal); }
@Override public Authorizable getAuthorizableByPath(String path) throws RepositoryException { return wrap(dlg.getAuthorizableByPath(path)); }
@Override public Authorizable getAuthorizableByPath(String path) throws RepositoryException { return wrap(dlg.getAuthorizableByPath(path)); }
@Override public Authorizable getAuthorizableByPath(String path) throws RepositoryException { return wrap(dlg.getAuthorizableByPath(path)); }
@Override protected void addMembers(@NotNull UserManager userManager, @NotNull Group group, @NotNull Session s) throws Exception { int j = 1; for (int i = 0; i <= numberOfMembers; i++) { String userPath = userPaths.get(random.nextInt(numberOfMembers)); group.addMember(userManager.getAuthorizableByPath(userPath)); if (j == batchSize) { s.save(); j = 1; } else { j++; } } } }
@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; } }
@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; } }
@CheckForNull private User getUser(@Nonnull 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; } }
@Test public void testGetAuthorizableByPath2() throws Exception { try { getUserManager(session).getAuthorizableByPath(user.getPath()); fail("invalid path must be detected"); } catch (RepositoryException e) { // success } }
@Test public void testGetAuthorizableByPath() throws Exception { assertNotNull(getUserManager(session).getAuthorizableByPath(authorizable.getPath())); }
public void testGetAuthorizableByPath() throws RepositoryException, NotExecutableException { String uid = superuser.getUserID(); Authorizable a = userMgr.getAuthorizable(uid); if (a == null) { throw new NotExecutableException(); } try { String path = a.getPath(); Authorizable a2 = userMgr.getAuthorizableByPath(path); assertNotNull(a2); assertEquals(a.getID(), a2.getID()); } catch (UnsupportedRepositoryOperationException e) { throw new NotExecutableException(); } }
@Test public void testGetAuthorizableByPath() throws RepositoryException, NotExecutableException { String uid = superuser.getUserID(); Authorizable a = userMgr.getAuthorizable(uid); if (a == null) { throw new NotExecutableException(); } try { String path = a.getPath(); Authorizable a2 = userMgr.getAuthorizableByPath(path); assertNotNull(a2); assertEquals(a.getID(), a2.getID()); } catch (UnsupportedRepositoryOperationException e) { throw new NotExecutableException(); } }
public void testGetUserByPath() throws Exception { user = createUser(uid); Authorizable authorizable = userMgr.getAuthorizableByPath(user.getPath()); assertNotNull(authorizable); assertFalse(authorizable.isGroup()); assertFalse(((User) authorizable).isAdmin()); assertTrue(((User) authorizable).isSystemUser()); assertEquals(user.getPath(), authorizable.getPath()); }
@Test public void testGetAuthorizable() throws RepositoryException { Authorizable a = mgr.getAuthorizable(UserConstants.DEFAULT_ANONYMOUS_ID); assertNotNull(a); assertTrue(a instanceof AuthorizableImpl); assertTrue(a instanceof UserImpl); a = mgr.getAuthorizableByPath(a.getPath()); assertNotNull(a); assertTrue(a instanceof AuthorizableImpl); assertTrue(a instanceof UserImpl); a = mgr.getAuthorizable(a.getPrincipal()); assertNotNull(a); assertTrue(a instanceof AuthorizableImpl); assertTrue(a instanceof UserImpl); assertNull(mgr.getAuthorizable("unknown")); }