Skip to main content
1 of 2
diamondsea
  • 358
  • 3
  • 5

In a custom module add this code (Devel module needs to be enabled) use the following code.

Alternatively, paste this code into Development->Execute PHP Code (you'll need to TEMPORARILY grant the user the the Devel:Access Developer Information and Devel:Execute PHP Code permissions and remove after testing)):

This will output using the dpm() function all the current users' roles and all their permissions (all, granted and denied) in the format ModuleName:PermissionName -> True/False

global $user;
dpm($user->roles, 'user roles');
    
$permissions = user_permission_get_modules();
foreach ($permissions as $key=>$value) {
  $has_perm = user_access($key);
  $perms["$value:$key"] = $has_perm;  
  if ($has_perm) {
    $perms_true["$value:$key"] = $has_perm;  
  } else {
    $perms_false["$value:$key"] = $has_perm;  
  }
}
dpm($perms, 'all user permissions');
dpm($perms_true, 'granted user permissions');
dpm($perms_false, 'denied user permissions');
diamondsea
  • 358
  • 3
  • 5