Search in sources :

Example 1 with UserAuthority

use of org.entando.entando.web.user.model.UserAuthority 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

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