You are here

function security_review_check_admin_permissions in Security Review 6

Same name and namespace in other branches
  1. 7 security_review.inc \security_review_check_admin_permissions()

Look for admin permissions granted to untrusted roles.

1 call to security_review_check_admin_permissions()
security_review_check_admin_permissions_help in ./security_review.help.inc
1 string reference to 'security_review_check_admin_permissions'
_security_review_security_checks in ./security_review.inc
Checks for security_review_security_checks() or security_review_get_checks().

File

./security_review.inc, line 505
Stand-alone security checks and review system.

Code

function security_review_check_admin_permissions() {
  $result = TRUE;
  $check_result_value = array();

  // Collect the permissions untrusted roles have.
  $untrusted = security_review_untrusteds_permissions();

  // Admin permissions.
  $admin_perms = security_review_admin_permissions();

  // Check for intersections.
  foreach ($untrusted as $rid => $permissions) {
    $intersect = array_intersect($permissions, $admin_perms);
    if (!empty($intersect)) {
      $check_result_value[$rid] = $intersect;
    }
  }
  if (!empty($check_result_value)) {
    $result = FALSE;
  }
  return array(
    'result' => $result,
    'value' => $check_result_value,
  );
}