use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class IsMemberTest method beforeSuite.
@Override
protected void beforeSuite() throws Exception {
super.beforeSuite();
Session s = loginAdministrative();
try {
UserManager userManager = ((JackrabbitSession) s).getUserManager();
Group gr = userManager.createGroup(new PrincipalImpl(GROUP + 0), REL_TEST_PATH);
gPaths.add(gr.getPath());
for (int i = 1; i < GROUP_CNT; i++) {
Group g = userManager.createGroup(new PrincipalImpl(GROUP + i), REL_TEST_PATH);
if (nestedGroups) {
g.addMember(gr);
}
gr = g;
gPaths.add(gr.getPath());
}
int cnt = 0;
for (int i = 0; i <= numberOfUsers; i++) {
User u = userManager.createUser(USER + i, null, new PrincipalImpl(USER + i), REL_TEST_PATH);
uPaths.add(u.getPath());
getRandomGroup(userManager).addMember(u);
if (++cnt == 20000) {
s.save();
}
}
} finally {
s.save();
s.logout();
}
System.out.println("setup done");
}
use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class GetGroupPrincipalsTest method beforeSuite.
@Override
public void beforeSuite() throws Exception {
super.beforeSuite();
session = loginAdministrative();
UserManager userManager = ((JackrabbitSession) session).getUserManager();
Authorizable user = userManager.getAuthorizable(USER);
if (user == null) {
user = userManager.createUser(USER, USER);
principalName = user.getPrincipal().getName();
}
// make sure we have a least a single group the user is member of.
Group gr = userManager.createGroup(new PrincipalImpl(GROUP), "test");
gr.addMember(user);
for (int i = 1; i < numberOfGroups; i++) {
Group g = userManager.createGroup(new PrincipalImpl(GROUP + i), "test");
if (!nestedGroups) {
g.addMember(user);
} else {
g.addMember(gr);
}
gr = g;
}
session.save();
}
use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class RemoveMembersTest method runTest.
@Override
public void runTest() throws Exception {
Session s = null;
try {
// use system session login to avoid measuring the login-performance here
s = systemLogin();
UserManager userManager = ((JackrabbitSession) s).getUserManager();
String groupPath = groupPaths.get(random.nextInt(GROUP_CNT));
Group g = (Group) userManager.getAuthorizableByPath(groupPath);
removeMembers(userManager, g, s);
} catch (RepositoryException e) {
if (s.hasPendingChanges()) {
s.refresh(false);
}
} finally {
if (s != null) {
s.logout();
}
}
}
use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class PermissionProviderImplTest method after.
@Override
public void after() throws Exception {
try {
root.getTree("/test").remove();
UserManager uMgr = getUserManager(root);
if (adminstrators != null) {
uMgr.getAuthorizable(adminstrators.getID()).remove();
}
if (root.hasPendingChanges()) {
root.commit();
}
} finally {
super.after();
}
}
use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class PermissionProviderImplTest method before.
@Override
public void before() throws Exception {
super.before();
new NodeUtil(root.getTree("/")).addChild("test", JcrConstants.NT_UNSTRUCTURED);
UserManager uMgr = getUserManager(root);
adminstrators = uMgr.createGroup(ADMINISTRATOR_GROUP);
root.commit();
config = getSecurityProvider().getConfiguration(AuthorizationConfiguration.class);
}
Aggregations