@Consumes ( { WILDCARD } )
@Facet ( name = "Unsupported" )
public Response assignUserToRole( @QueryParam ( "tenant" ) String tenantPath,
@QueryParam ( "userNames" ) String userNames, @QueryParam ( "roleName" ) String roleName ) {
if ( canAdminister() ) {
IUserRoleDao roleDao =
PentahoSystem.get( IUserRoleDao.class, "userRoleDaoProxy", PentahoSessionHolder.getSession() );
StringTokenizer tokenizer = new StringTokenizer( userNames, "\t" );
Set<String> assignedUserNames = new HashSet<String>();
for ( IPentahoUser pentahoUser : roleDao.getRoleMembers( getTenant( tenantPath ), roleName ) ) {
assignedUserNames.add( pentahoUser.getUsername() );
}
while ( tokenizer.hasMoreTokens() ) {
assignedUserNames.add( tokenizer.nextToken() );
}
try {
roleDao.setRoleMembers( getTenant( tenantPath ), roleName, assignedUserNames.toArray( new String[0] ) );
return Response.ok().build();
} catch ( Throwable th ) {
return processErrorResponse( th.getLocalizedMessage() );
}
} else {