use of org.pentaho.platform.security.userroledao.ws.UserToRoleAssignment in project pentaho-kettle by pentaho.
the class UserRoleHelper method getRolesForUser.
public static Set<IRole> getRolesForUser(String name, List<UserToRoleAssignment> assignments, IRoleSupportSecurityManager rsm) {
if (assignments == null || assignments.isEmpty()) {
return Collections.emptySet();
}
Set<IRole> roles = new HashSet<IRole>(assignments.size());
for (UserToRoleAssignment assignment : assignments) {
if (name.equals(assignment.getUserId())) {
IRole role = null;
try {
role = rsm.constructRole();
} catch (KettleException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (role != null) {
role.setName(assignment.getRoleId());
roles.add(role);
}
}
}
return roles;
}
Aggregations