use of com.enonic.xp.security.Role in project xp by enonic.
the class ModifyRoleHandlerTest method invokeUpdate.
private Role invokeUpdate(final UpdateRoleParams params) {
final RoleEditor editor = params.getEditor();
assertNotNull(editor);
final Role role = TestDataFixtures.getTestRole();
final EditableRole editable = new EditableRole(role);
editor.edit(editable);
return editable.build();
}
use of com.enonic.xp.security.Role in project xp by enonic.
the class GetMembershipsHandlerTest method testExamples.
@Test
public void testExamples() {
final Role role = TestDataFixtures.getTestRole();
final Group group = TestDataFixtures.getTestGroup();
final PrincipalKeys principalKeys = PrincipalKeys.from(role.getKey(), group.getKey());
Mockito.when(securityService.getMemberships(PrincipalKey.from("user:myIdProvider:userId"))).thenReturn(principalKeys);
Mockito.when(securityService.getPrincipals(principalKeys)).thenReturn(Principals.from(role, group));
runScript("/lib/xp/examples/auth/getMemberships.js");
}
use of com.enonic.xp.security.Role in project xp by enonic.
the class GetMembershipsHandlerTest method testGetUserMembershipsWithRoleAndGroup.
@Test
public void testGetUserMembershipsWithRoleAndGroup() {
final Role role = TestDataFixtures.getTestRole();
final Group group = TestDataFixtures.getTestGroup();
final PrincipalKeys principalKeys = PrincipalKeys.from(role.getKey(), group.getKey());
Mockito.when(securityService.getMemberships(PrincipalKey.from("user:myIdProvider:userId"))).thenReturn(principalKeys);
Mockito.when(securityService.getPrincipals(principalKeys)).thenReturn(Principals.from(role, group));
runFunction("/test/getMemberships-test.js", "getUserMembershipsWithRoleAndGroup");
}
Aggregations