use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class UserManagementTest method testCreateWithIntermediateReadDeny2.
@Test
public void testCreateWithIntermediateReadDeny2() throws Exception {
String path = UserConstants.DEFAULT_GROUP_PATH + "/a";
JcrUtils.getOrCreateByPath(path, UserConstants.NT_REP_AUTHORIZABLE_FOLDER, superuser);
superuser.save();
try {
deny(UserConstants.DEFAULT_GROUP_PATH, privilegesFromName(Privilege.JCR_READ));
Privilege[] privs = privilegesFromNames(new String[] { Privilege.JCR_READ, PrivilegeConstants.REP_USER_MANAGEMENT, PrivilegeConstants.REP_WRITE });
allow(path, privs);
Group gr = getUserManager(testSession).createGroup(groupId, new PrincipalImpl(groupId), "a/b/c");
testSession.save();
} finally {
superuser.refresh(false);
superuser.getNode(UserConstants.DEFAULT_GROUP_PATH + "/a").remove();
JackrabbitAccessControlList acl = AccessControlUtils.getAccessControlList(acMgr, UserConstants.DEFAULT_GROUP_PATH);
if (acl != null) {
acMgr.removePolicy(UserConstants.DEFAULT_GROUP_PATH, acl);
}
superuser.save();
}
}
use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class MemberBaseTest method beforeSuite.
@Override
public void beforeSuite() throws Exception {
super.beforeSuite();
Session s = loginAdministrative();
try {
List<String> memberIds = new ArrayList<String>(numberOfMembers);
UserManager userManager = ((JackrabbitSession) s).getUserManager();
for (int i = 0; i <= numberOfMembers; i++) {
User u = userManager.createUser(USER + i, null, new PrincipalImpl(USER + i), REL_TEST_PATH);
memberPaths.add(u.getPath());
memberIds.add(USER + i);
}
String[] idArray = memberIds.toArray(new String[memberIds.size()]);
for (int i = 0, j = 1; i <= numberOfGroups; i++, j++) {
Group g = userManager.createGroup(new PrincipalImpl(GROUP + i), REL_TEST_PATH);
groupPaths.add(g.getPath());
if (nested) {
g.addMembers(ObjectArrays.concat(idArray, GROUP + j));
} else {
g.addMembers(idArray);
}
}
} finally {
s.save();
s.logout();
}
System.out.println("setup done");
}
use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class RemoveMemberTest method createUsers.
protected void createUsers(@Nonnull UserManager userManager) throws Exception {
for (int i = 0; i <= numberOfMembers; i++) {
String id = USER + i;
User u = userManager.createUser(id, null, new PrincipalImpl(id), REL_TEST_PATH);
userPaths.add(u.getPath());
}
}
use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class UserManagerImpl method createSystemUser.
@Override
public User createSystemUser(String userID, String intermediatePath) throws RepositoryException {
checkValidId(userID);
Principal principal = new PrincipalImpl(userID);
checkValidPrincipal(principal, false);
Tree userTree = userProvider.createSystemUser(userID, intermediatePath);
setPrincipal(userTree, principal);
User user = new SystemUserImpl(userID, userTree, this);
log.debug("System user created: " + userID);
return user;
}
use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class UserPrincipalProvider method getPrincipal.
//--------------------------------------------------< PrincipalProvider >---
@Override
public Principal getPrincipal(@Nonnull String principalName) {
Tree authorizableTree = userProvider.getAuthorizableByPrincipal(new PrincipalImpl(principalName));
Principal principal = createPrincipal(authorizableTree);
if (principal == null) {
// no such principal or error while accessing principal from user/group
return (EveryonePrincipal.NAME.equals(principalName)) ? EveryonePrincipal.getInstance() : null;
} else {
return principal;
}
}
Aggregations