You are here

function secure_permissions_secure_permissions in Secure Permissions 7

Same name and namespace in other branches
  1. 6 secure_permissions.module \secure_permissions_secure_permissions()
  2. 7.2 secure_permissions.module \secure_permissions_secure_permissions()

Implements hook_secure_permissions().

If configured to do so, this function will restore the default site permissions that ship with Drupal. It will also maintain an administrative role that has all permissions.

Important: If you use this module, you must implement this hook in your own code, or else risk having permissions reset.

File

./secure_permissions.module, line 267
Secure Permissions module file.

Code

function secure_permissions_secure_permissions($role) {
  $permissions = array();

  // Use the default permissions granted by Drupal core?
  if (secure_permissions_variable('secure_permissions_use_default')) {

    // Enable default permissions for system roles. See standard.install.
    $filtered_html_format = filter_format_load('filtered_html');
    $filtered_html_permission = filter_permission_name($filtered_html_format);
    $permissions['anonymous user'] = array(
      'access content',
      $filtered_html_permission,
    );
    $permissions['authenticated user'] = array(
      'access content',
      'access comments',
      'post comments',
      'post comments without approval',
      $filtered_html_permission,
    );
  }

  // Return the permissions.
  if (isset($permissions[$role])) {
    return $permissions[$role];
  }
}