use of org.apache.jackrabbit.api.security.user.Group in project jackrabbit-oak by apache.
the class UserManagerTest method testCreateGroupWithExistingPrincipal2.
@Test
public void testCreateGroupWithExistingPrincipal2() throws RepositoryException, NotExecutableException {
Principal p = getTestPrincipal();
String uid = createUserId();
assertFalse(uid.equals(p.getName()));
User u = null;
try {
// create a user with the given ID
u = userMgr.createUser(uid, "pw", p, null);
superuser.save();
// assert AuthorizableExistsException for principal that is already in use
Group gr = null;
try {
gr = userMgr.createGroup(p);
fail("Principal " + p.getName() + " is already in use -> must throw AuthorizableExistsException.");
} catch (AuthorizableExistsException e) {
// expected this
} finally {
if (gr != null) {
gr.remove();
superuser.save();
}
}
} finally {
if (u != null) {
u.remove();
superuser.save();
}
}
}
use of org.apache.jackrabbit.api.security.user.Group in project jackrabbit-oak by apache.
the class UserQueryTest method createGroup.
private Group createGroup(String name) throws RepositoryException {
Group group = userMgr.createGroup(name);
groups.add(group);
return group;
}
use of org.apache.jackrabbit.api.security.user.Group in project jackrabbit-oak by apache.
the class ExternalGroupPrincipalProviderTest method testGetPrincipalExternalGroup.
@Test
public void testGetPrincipalExternalGroup() throws Exception {
Group gr = getUserManager(root).getAuthorizable("secondGroup", Group.class);
assertNotNull(gr);
assertNull(principalProvider.getPrincipal(gr.getPrincipal().getName()));
}
use of org.apache.jackrabbit.api.security.user.Group in project jackrabbit-oak by apache.
the class ExternalGroupPrincipalProviderTest method testGetPrincipalLocalGroup.
@Test
public void testGetPrincipalLocalGroup() throws Exception {
Group gr = createTestGroup();
assertNull(principalProvider.getPrincipal(gr.getPrincipal().getName()));
}
use of org.apache.jackrabbit.api.security.user.Group in project jackrabbit-oak by apache.
the class SyncMBeanImplTest method testInitialSyncExternalGroup.
@Test
public void testInitialSyncExternalGroup() throws Exception {
ExternalGroup externalGroup = idp.getGroup("a");
String[] externalId = new String[] { externalGroup.getExternalId().getString() };
String[] result = syncMBean.syncExternalUsers(externalId);
assertResultMessages(result, "a", "add");
UserManager userManager = getUserManager();
Group aGroup = userManager.getAuthorizable(externalGroup.getId(), Group.class);
assertNotNull(aGroup);
// membership of groups are not synced (unless imposed by user-sync with membership depth)
for (ExternalIdentityRef groupRef : externalGroup.getDeclaredGroups()) {
assertNull(userManager.getAuthorizable(groupRef.getId()));
}
}
Aggregations