use of org.entando.entando.web.user.model.UserAuthoritiesRequest in project entando-core by entando.
the class UserValidator method validate.
@Override
public void validate(Object target, Errors errors) {
if (target instanceof UserAuthoritiesRequest) {
UserAuthoritiesRequest request = (UserAuthoritiesRequest) target;
validateGroupsAndRoles(request, errors);
}
}
use of org.entando.entando.web.user.model.UserAuthoritiesRequest in project entando-core by entando.
the class UserServiceIntegrationTest method testAddAndRemoveUserAuthorities.
@Test
public void testAddAndRemoveUserAuthorities() throws Throwable {
try {
UserAuthoritiesRequest request = new UserAuthoritiesRequest();
UserAuthority auth = new UserAuthority();
auth.setGroup("management");
auth.setRole("pageManager");
request.add(auth);
List<UserAuthorityDto> resp = userService.addUserAuthorities("editorCustomers", request);
assertNotNull(resp);
assertEquals(1, resp.size());
assertEquals("management", resp.get(0).getGroup());
} finally {
UserAuthoritiesRequest request = new UserAuthoritiesRequest();
UserAuthority auth = new UserAuthority();
auth.setGroup("customers");
auth.setRole("editor");
request.add(auth);
List<UserAuthorityDto> resp = userService.addUserAuthorities("editorCustomers", request);
assertNotNull(resp);
assertEquals(1, resp.size());
assertEquals("customers", resp.get(0).getGroup());
}
}
Aggregations