Can you filter views user list result based on the current users role
As I understand, you want to create a view which list users which lists only those users who has a specific role or roles that the current user also has. The below approach can be a solution :


Add a field 'User: Uid' in your view (Let the view is of type 'Users').
Make the field as 'Exclude from display'.
Add a 'global php' field and add some code as below under 'VALUE CODE' :


$user_load = user_load($data->uid);
$data->user_role = $user_load->roles;
return ($data->user_role);


Here, we are getting the roles of each user being rendered.

Here used '$data->uid' instead of '$row->uid' to avoide issue of returning NID with $row in D7. Although in this case '$row->uid' returns correct information.
Make the field as 'Exclude from display' as well.
Under Filter Criteria add a 'global php' field and add the below codes :

i) Under 'Setup Code' :
 
 global $user;
 $roles = array();
 $view->roles = $user->roles;
 

Here we are getting all the roles of the current user.

ii) User 'Filter Code' :
 
 // Suppose you have five roles in the instance with the 'rid's as saved in
 // 'role' table as : 1 (anonymous user), 2(authenticated user), 3(administrator), 4(hr), 5(web admin)
 // Suppose ROLE you want be matched has RID = 4
 if (isset($view->roles[4])) {// Checking if the current user has the role that you want to be matched with
   if (!isset($data->user_role[4])) {// If the user getting rendered doesn't have that role
     return TRUE;// If TRUE is returned, then that row is NOT shown
   }
 }
 


Note : Considering, 'views_php' module is installed.

Note : If the current user doesn't have the role that you want be filtered for, then the view will list the default list of users based on other conditions.

Note : Instead of writing the 'rid' in the filter code directly, we can provide an admin menu which will render a custom form with a text field and, admin or user with required access permission, can set any role(s) through that form and save it in a drupal variable, and we can render the role information we want be matched from the variable inside our filter code.

Hope it helps