Search in sources :

Example 1 with UserAuthoritiesRequest

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);
    }
}
Also used : UserAuthoritiesRequest(org.entando.entando.web.user.model.UserAuthoritiesRequest)

Example 2 with UserAuthoritiesRequest

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());
    }
}
Also used : UserAuthoritiesRequest(org.entando.entando.web.user.model.UserAuthoritiesRequest) UserAuthorityDto(org.entando.entando.aps.system.services.user.model.UserAuthorityDto) UserAuthority(org.entando.entando.web.user.model.UserAuthority) Test(org.junit.Test)

Aggregations

UserAuthoritiesRequest (org.entando.entando.web.user.model.UserAuthoritiesRequest)2 UserAuthorityDto (org.entando.entando.aps.system.services.user.model.UserAuthorityDto)1 UserAuthority (org.entando.entando.web.user.model.UserAuthority)1 Test (org.junit.Test)1