Search in sources :

Example 1 with WSPutRolePermissionRequest

use of org.geosdi.geoplatform.request.organization.WSPutRolePermissionRequest in project geo-platform by geosdi.

the class UserService method updateRolePermission.

@Override
public boolean updateRolePermission(String role, String organization, HashMap<String, Boolean> permissionMap, HttpServletRequest httpServletRequest) throws GeoPlatformException {
    GuiComponentsPermissionMapData rolePermission = new GuiComponentsPermissionMapData();
    rolePermission.setPermissionMap(permissionMap);
    try {
        return geoPlatformServiceClient.updateRolePermission(new WSPutRolePermissionRequest(rolePermission, role, organization));
    } catch (ResourceNotFoundFault ex) {
        logger.error(this.getClass().getSimpleName(), ex.getMessage());
        throw new GeoPlatformException("Unable to find \"" + role + "\" role");
    }
}
Also used : GuiComponentsPermissionMapData(org.geosdi.geoplatform.response.collection.GuiComponentsPermissionMapData) WSPutRolePermissionRequest(org.geosdi.geoplatform.request.organization.WSPutRolePermissionRequest) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException)

Example 2 with WSPutRolePermissionRequest

use of org.geosdi.geoplatform.request.organization.WSPutRolePermissionRequest in project geo-platform by geosdi.

the class RSRolePermissionTest method updateRolePermissionTestRest.

@Test(expected = NotFoundException.class)
public void updateRolePermissionTestRest() throws Exception {
    GuiComponentsPermissionMapData userMapData = new GuiComponentsPermissionMapData();
    userMapData.setPermissionMap(new HashMap<>(GuiComponentIDs.MAP_USER));
    assertTrue(gpWSClient.updateRolePermission(new WSPutRolePermissionRequest(userMapData, USER.getRole(), organizationNameRSTest)));
    GuiComponentsPermissionMapData wsUserMapData = gpWSClient.getRolePermission(USER.getRole(), organizationNameRSTest);
    logger.trace("\n\n@@@@@@@@@@@@@@@@@@@@@@@@@@@RETRIEVE GuiComponents for  USER_ROLE : {}\n\n", wsUserMapData);
    assertEquals(51, wsUserMapData.getPermissionMap().size());
    GuiComponentsPermissionMapData viewerMapData = new GuiComponentsPermissionMapData();
    viewerMapData.setPermissionMap(new HashMap<>(MAP_VIEWER));
    assertTrue(gpWSClient.updateRolePermission(new WSPutRolePermissionRequest(viewerMapData, VIEWER.getRole(), organizationNameRSTest)));
    GuiComponentsPermissionMapData wsViewerMapData = gpWSClient.getRolePermission(VIEWER.getRole(), organizationNameRSTest);
    logger.trace("\n\n@@@@@@@@@@@@@@@@@@@@@@@@@@@RETRIEVE GuiComponents for  VIEWER_ROLE : {}\n\n", wsViewerMapData);
    assertEquals(50, wsViewerMapData.getPermissionMap().size());
}
Also used : GuiComponentsPermissionMapData(org.geosdi.geoplatform.response.collection.GuiComponentsPermissionMapData) WSPutRolePermissionRequest(org.geosdi.geoplatform.request.organization.WSPutRolePermissionRequest) Test(org.junit.Test)

Example 3 with WSPutRolePermissionRequest

use of org.geosdi.geoplatform.request.organization.WSPutRolePermissionRequest in project geo-platform by geosdi.

the class GPJacksonRolePermissionsSupportTest method putRolePermissionDataMappingTest.

@Test
public void putRolePermissionDataMappingTest() throws Exception {
    WSPutRolePermissionRequest putPermissionReques = jacksonSupport.getDefaultMapper().readValue(Thread.currentThread().getContextClassLoader().getResourceAsStream(PUT_ROLE_PERMISSION_REQUEST_DATA_JSON), WSPutRolePermissionRequest.class);
    logger.info("\n\n@@@@@@@@@@@@@@PUT_ROLE_PERMISSION_REQUEST_DATA_MAPPING" + " : {}\n\n", putPermissionReques);
    super.marshall(putPermissionReques);
}
Also used : WSPutRolePermissionRequest(org.geosdi.geoplatform.request.organization.WSPutRolePermissionRequest) Test(org.junit.Test)

Aggregations

WSPutRolePermissionRequest (org.geosdi.geoplatform.request.organization.WSPutRolePermissionRequest)3 GuiComponentsPermissionMapData (org.geosdi.geoplatform.response.collection.GuiComponentsPermissionMapData)2 Test (org.junit.Test)2 ResourceNotFoundFault (org.geosdi.geoplatform.exception.ResourceNotFoundFault)1 GeoPlatformException (org.geosdi.geoplatform.gui.global.GeoPlatformException)1