use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class AccessControlManagerImplTest method testGetApplicablePoliciesInternalPrincipal.
@Test
public void testGetApplicablePoliciesInternalPrincipal() throws Exception {
Principal unknown = getPrincipalManager(root).getPrincipal("unknown");
int i = 0;
while (unknown != null) {
unknown = getPrincipalManager(root).getPrincipal("unknown" + i);
}
unknown = new PrincipalImpl("unknown" + i);
assertEquals(1, acMgr.getApplicablePolicies(unknown).length);
}
use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class AbstractPrincipalProviderTest method before.
@Override
public void before() throws Exception {
super.before();
userPrincipal = getTestUser().getPrincipal();
nonExisting = new PrincipalImpl("nonExisting");
groupId = "testGroup" + UUID.randomUUID();
testGroup = getUserManager(root).createGroup(groupId);
testGroup.addMember(getTestUser());
groupId2 = "testGroup2" + UUID.randomUUID();
testGroup2 = getUserManager(root).createGroup(groupId2);
testGroup.addMember(testGroup2);
root.commit();
principalProvider = createPrincipalProvider();
assertNull(principalProvider.getPrincipal(nonExisting.getName()));
}
use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class AbstractGroupPrincipalTest method testIsMemberOf.
@Test
public void testIsMemberOf() throws Exception {
final Principal p = getTestUser().getPrincipal();
assertTrue(agp.isMember(p));
assertTrue(agp.isMember(new PrincipalImpl(p.getName())));
assertTrue(agp.isMember(new Principal() {
@Override
public String getName() {
return p.getName();
}
}));
}
use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class AuthorizablePropertiesImplTest method before.
@Override
public void before() throws Exception {
super.before();
User user = getTestUser();
emptyProperties = new AuthorizablePropertiesImpl((AuthorizableImpl) user, getNamePathMapper());
String id2 = "user2" + UUID.randomUUID().toString();
user2 = getUserManager(root).createUser(id2, null, new PrincipalImpl(id2), PathUtils.getAncestorPath(user.getPath(), 1));
vf = getValueFactory(root);
Value v = vf.createValue("value");
Value[] vArr = new Value[] { vf.createValue(2), vf.createValue(30) };
user2.setProperty("prop", v);
user2.setProperty("mvProp", vArr);
user2.setProperty("relPath/prop", v);
user2.setProperty("relPath/mvProp", vArr);
root.commit();
properties = new AuthorizablePropertiesImpl((AuthorizableImpl) user2, getNamePathMapper());
}
use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class RandomAuthorizableNodeNameTest method testCreateUserWithPath.
@Test
public void testCreateUserWithPath() throws Exception {
User user = getUserManager(root).createUser(id, "pw", new PrincipalImpl(id), "a/b");
root.commit();
assertNodeName(user, "a/b");
}
Aggregations