use of org.pentaho.platform.security.userroledao.ws.UserToRoleAssignment in project pentaho-kettle by pentaho.
the class UserRoleHelperTest method convertFromProxyPentahoUser_CopiesRolesForEeUser.
@Test
public void convertFromProxyPentahoUser_CopiesRolesForEeUser() throws Exception {
IRoleSupportSecurityManager manager = mockSecurityManager(true);
ProxyPentahoUser pentahoUser = pentahoUser("name");
List<UserToRoleAssignment> assignments = Collections.singletonList(new UserToRoleAssignment("name", "role"));
EEUserInfo user = (EEUserInfo) convertFromProxyPentahoUser(pentahoUser, assignments, manager);
assertNotNull(user);
assertEquals(pentahoUser.getName(), user.getName());
assertEquals(1, user.getRoles().size());
assertEquals("role", user.getRoles().iterator().next().getName());
}
use of org.pentaho.platform.security.userroledao.ws.UserToRoleAssignment in project pentaho-kettle by pentaho.
the class UserRoleHelper method convertFromProxyPentahoUsers.
/* EESOURCE: UPDATE SERIALVERUID */
public static List<IUser> convertFromProxyPentahoUsers(UserRoleSecurityInfo info, IRoleSupportSecurityManager rsm) {
List<ProxyPentahoUser> users = info.getUsers();
if (users == null || users.isEmpty()) {
return Collections.emptyList();
}
List<UserToRoleAssignment> assignments = info.getAssignments();
List<IUser> userList = new ArrayList<IUser>(users.size());
for (ProxyPentahoUser user : users) {
userList.add(convertFromProxyPentahoUser(user, assignments, rsm));
}
return userList;
}
use of org.pentaho.platform.security.userroledao.ws.UserToRoleAssignment in project pentaho-kettle by pentaho.
the class UserRoleHelper method convertToListFromProxyPentahoDefaultRoles.
public static List<IRole> convertToListFromProxyPentahoDefaultRoles(UserRoleSecurityInfo info, IRoleSupportSecurityManager rsm) {
List<IRole> roleList = new ArrayList<IRole>();
List<ProxyPentahoRole> roles = info.getDefaultRoles();
List<UserToRoleAssignment> assignments = info.getAssignments();
for (ProxyPentahoRole role : roles) {
roleList.add(convertFromProxyPentahoRole(role, assignments, rsm));
}
return roleList;
}
use of org.pentaho.platform.security.userroledao.ws.UserToRoleAssignment in project pentaho-kettle by pentaho.
the class UserRoleHelper method getUsersForRole.
public static Set<IUser> getUsersForRole(String name, List<UserToRoleAssignment> assignments, IRoleSupportSecurityManager rsm) {
Set<IUser> users = new HashSet<IUser>();
for (UserToRoleAssignment assignment : assignments) {
if (name.equals(assignment.getRoleId())) {
IUser user = null;
try {
user = rsm.constructUser();
} catch (KettleException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
user.setLogin(assignment.getUserId());
users.add(user);
}
}
return users;
}
use of org.pentaho.platform.security.userroledao.ws.UserToRoleAssignment in project pentaho-kettle by pentaho.
the class UserRoleHelper method convertToListFromProxyPentahoRoles.
public static List<IRole> convertToListFromProxyPentahoRoles(UserRoleSecurityInfo info, IRoleSupportSecurityManager rsm) {
List<IRole> roleList = new ArrayList<IRole>();
List<ProxyPentahoRole> roles = info.getRoles();
List<UserToRoleAssignment> assignments = info.getAssignments();
for (ProxyPentahoRole role : roles) {
roleList.add(convertFromProxyPentahoRole(role, assignments, rsm));
}
return roleList;
}
Aggregations