Search in sources :

Example 11 with UpdateUserPermissions

use of org.activityinfo.legacy.shared.command.UpdateUserPermissions in project activityinfo by bedatadriven.

the class UpdateUserPermissionsHandlerTest method testFolderLevelUpdate.

@Test
@OnDataSet("/dbunit/schema3.db.xml")
public void testFolderLevelUpdate() {
    setUser(1);
    UserPermissionDTO newUser = new UserPermissionDTO();
    newUser.setName("Bavon");
    newUser.setEmail("bavon@nrcdrc.org");
    newUser.setPartner(new PartnerDTO(1, "NRC"));
    newUser.setAllowView(true);
    newUser.setAllowViewAll(false);
    newUser.setAllowEdit(true);
    newUser.setAllowEdit(false);
    newUser.setAllowDesign(true);
    FolderDTO health = new FolderDTO();
    health.setId(3);
    newUser.setFolders(Arrays.asList(health));
    newUser.setFolderLimitation(true);
    execute(new UpdateUserPermissions(1, newUser));
    UserResult users = execute(new GetUsers(1));
    UserPermissionDTO bavon = users.getData().get(0);
    assertThat(bavon.hasFolderLimitation(), equalTo(true));
}
Also used : FolderDTO(org.activityinfo.legacy.shared.model.FolderDTO) PartnerDTO(org.activityinfo.legacy.shared.model.PartnerDTO) UpdateUserPermissions(org.activityinfo.legacy.shared.command.UpdateUserPermissions) UserResult(org.activityinfo.legacy.shared.command.result.UserResult) GetUsers(org.activityinfo.legacy.shared.command.GetUsers) UserPermissionDTO(org.activityinfo.legacy.shared.model.UserPermissionDTO) OnDataSet(org.activityinfo.server.database.OnDataSet) Test(org.junit.Test)

Aggregations

UpdateUserPermissions (org.activityinfo.legacy.shared.command.UpdateUserPermissions)11 UserPermissionDTO (org.activityinfo.legacy.shared.model.UserPermissionDTO)10 Test (org.junit.Test)8 GetUsers (org.activityinfo.legacy.shared.command.GetUsers)3 UserResult (org.activityinfo.legacy.shared.command.result.UserResult)3 PartnerDTO (org.activityinfo.legacy.shared.model.PartnerDTO)3 OnDataSet (org.activityinfo.server.database.OnDataSet)3 VoidResult (org.activityinfo.legacy.shared.command.result.VoidResult)2 MaskingAsyncMonitor (org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor)2 ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)1 Record (com.extjs.gxt.ui.client.store.Record)1 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1 BatchCommand (org.activityinfo.legacy.shared.command.BatchCommand)1 BatchResult (org.activityinfo.legacy.shared.command.result.BatchResult)1 UserExistsException (org.activityinfo.legacy.shared.command.result.UserExistsException)1 FolderDTO (org.activityinfo.legacy.shared.model.FolderDTO)1 FormDialogCallback (org.activityinfo.ui.client.page.common.dialog.FormDialogCallback)1 FormDialogImpl (org.activityinfo.ui.client.page.common.dialog.FormDialogImpl)1 FolderAssignmentException (org.activityinfo.ui.client.page.config.form.FolderAssignmentException)1 PermissionAssignmentException (org.activityinfo.ui.client.page.config.form.PermissionAssignmentException)1