You are here

function _permissions_lock_get_available_permissions in Permissions Lock 7

Get a list of available permissions on the website

1 call to _permissions_lock_get_available_permissions()
permissions_lock_settings_form in ./permissions_lock.module
Settings form to control which permissions and / or roles have to be locked

File

./permissions_lock.module, line 191
Lock permissions on the permissions administration pages for certain roles

Code

function _permissions_lock_get_available_permissions($exclude_hook = TRUE) {

  // Render role/permission overview:
  $available_permissions = array();
  foreach (module_list(FALSE, FALSE, TRUE) as $module) {
    if ($permissions = module_invoke($module, 'permission')) {
      asort($permissions);
      foreach ($permissions as $perm => $perm_info) {
        $available_permissions[$perm] = $perm_info['title'];
      }
    }
  }
  if ($exclude_hook) {
    if ($hook_locks = permissions_lock_get_hook_data('permission')) {
      foreach ($hook_locks as $perm) {
        unset($available_permissions[$perm]);
      }
    }
  }
  return $available_permissions;
}