use of org.pentaho.platform.security.userroledao.ws.ProxyPentahoUser in project pentaho-kettle by pentaho.
the class UserRoleDelegate method deleteUser.
public void deleteUser(String name) throws KettleException {
ensureHasPermissions();
try {
ProxyPentahoUser user = userRoleWebService.getUser(name);
if (user != null) {
ProxyPentahoUser[] users = new ProxyPentahoUser[1];
users[0] = user;
userRoleWebService.deleteUsers(users);
fireUserRoleListChange();
} else {
throw new KettleException(BaseMessages.getString(UserRoleDelegate.class, "UserRoleDelegate.ERROR_0004_UNABLE_TO_DELETE_USER", // $NON-NLS-1$
name));
}
} catch (Exception e) {
throw new KettleException(BaseMessages.getString(UserRoleDelegate.class, "UserRoleDelegate.ERROR_0004_UNABLE_TO_DELETE_USER", name), // $NON-NLS-1$
e);
}
}
use of org.pentaho.platform.security.userroledao.ws.ProxyPentahoUser in project pentaho-kettle by pentaho.
the class UserRoleDelegate method getUser.
public IUser getUser(String name) throws KettleException {
ensureHasPermissions();
IUser userInfo = null;
try {
ProxyPentahoUser user = userRoleWebService.getUser(name);
if (user != null && user.getName().equals(name)) {
userInfo = UserRoleHelper.convertToUserInfo(user, userRoleWebService.getRolesForUser(user), rsm);
}
} catch (Exception e) {
throw new KettleException(BaseMessages.getString(UserRoleDelegate.class, "UserRoleDelegate.ERROR_0005_UNABLE_TO_GET_USER", name), // $NON-NLS-1$
e);
}
return userInfo;
}
use of org.pentaho.platform.security.userroledao.ws.ProxyPentahoUser in project pentaho-kettle by pentaho.
the class UserRoleHelper method convertToPentahoProxyUsers.
public static ProxyPentahoUser[] convertToPentahoProxyUsers(Set<IUser> users) {
ProxyPentahoUser[] proxyUsers = new ProxyPentahoUser[users.size()];
int i = 0;
for (IUser user : users) {
proxyUsers[i++] = convertToPentahoProxyUser(user);
}
return proxyUsers;
}
use of org.pentaho.platform.security.userroledao.ws.ProxyPentahoUser in project pentaho-kettle by pentaho.
the class UserRoleHelper method convertToPentahoProxyUsers.
public static ProxyPentahoUser[] convertToPentahoProxyUsers(List<IUser> users) {
ProxyPentahoUser[] proxyUsers = new ProxyPentahoUser[users.size()];
int i = 0;
for (IUser user : users) {
proxyUsers[i++] = convertToPentahoProxyUser(user);
}
return proxyUsers;
}
use of org.pentaho.platform.security.userroledao.ws.ProxyPentahoUser in project pentaho-platform by pentaho.
the class UserRoleWebServiceBase method testGetUsersForRole.
@Test
public void testGetUsersForRole() throws UserRoleException {
IUserRoleWebService service = getUserRoleWebService();
mockUserAsAdmin(false);
ProxyPentahoRole roleObj = new ProxyPentahoRole("testRole1");
try {
service.getUsersForRole(roleObj);
Assert.fail();
} catch (UserRoleException e) {
Assert.assertTrue("ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf("ERROR_0001") >= 0);
}
mockUserAsAdmin(true);
ProxyPentahoUser[] userObjs = service.getUsersForRole(roleObj);
Assert.assertEquals(1, userObjs.length);
}
Aggregations