use of org.activityinfo.legacy.shared.command.GetUsers 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));
}
use of org.activityinfo.legacy.shared.command.GetUsers in project activityinfo by bedatadriven.
the class GetUsersTest method testUnsorted.
@Test
public void testUnsorted() throws CommandException {
setUser(DATABASE_OWNER);
GetUsers cmd = new GetUsers(1);
UserResult result = execute(cmd);
assertThat(result.getData(), hasSize(3));
}
use of org.activityinfo.legacy.shared.command.GetUsers in project activityinfo by bedatadriven.
the class GetUsersTest method testManageUsersPermission.
/**
* Verify that users with ManageUsers permission can get a list of users
* within their organisation
*/
@Test
public void testManageUsersPermission() throws CommandException {
// populate with a known state and authenticate as user 3, who
// has ManageUser permissions for Solidarites
// Lisa from Solidarites
setUser(3);
// execute
UserResult result = execute(new GetUsers(1));
// VERIFY that we have 1 result:
// - the one other solidarites user
assertThat(result.getTotalLength(), equalTo(1));
UserPermissionDTO marlene = result.getData().get(0);
assertThat(marlene.getName(), equalTo("Marlene"));
assertThat(marlene.hasFolderLimitation(), equalTo(false));
}
Aggregations