1 file.module file_permission()

Implements hook_permission().


core/modules/file/file.module, line 135
Defines a "managed_file" Form API field and a "file" field for Field module.


function file_permission() {
  $permissions = array(
    'access file overview' => array(
      'title' => t('Access the manage files overview'),
      'description' => t('The <a href="@url">manage files overview page</a> shows all files uploaded to the site.', array('@url' => url('admin/content/files'))),
    'bypass file access' => array(
      'title' => t('Bypass file access control'),
      'description' => t('View, edit and delete all files regardless of permission restrictions.'),
      'restrict access' => TRUE,
      'warning' => t('Bypasses all other file permissions.'),
    'administer file types' => array(
      'title' => t('Administer file types'),
      'restrict access' => TRUE,
      'warning' => t('Potentially-dangerous filetypes can be allowed on the site (e.g.: <code>.zip</code>, <code>.exe</code>, etc.).'),
    'create files' => array(
      'title' => t('Add and upload new files'),
    'view own private files' => array(
      'title' => t('View own private files'),
    'view own files' => array(
      'title' => t('View own files'),
    'view private files' => array(
      'title' => t('View private files'),
      'restrict access' => TRUE,
      'warning' => t('Viewing files not available to the public can lead to a breach of private/sensitive information.'),
    'view files' => array(
      'title' => t('View files'),
    'manage files' => array(
      'title' => t('Manage or replace any file'),
      'description' => t('Allow managing of files from the files overview page.'),
      'restrict access' => TRUE,
      'warning' => t('Private files can be made publicly-available.'),
    'delete files' => array(
      'title' => t('Delete any file'),
      'description' => t('Allow deleting files directly from the manage files overview page.'),
      'restrict access' => TRUE,
      'warning' => t('Deleting files can cause irreversible data loss.'),

  // Add description for the 'View file details' and 'View own private file
  // details' permissions to show which stream wrappers they apply to.
  $wrappers = file_get_public_and_private_stream_wrapper_names();
  $wrappers += array('public' => array(t('None')), 'private' => array(t('None')));

  $permissions['view files']['description'] = t('Includes the following stream wrappers: %wrappers.', array('%wrappers' => implode(', ', $wrappers['public'])));
  $permissions['view own private files']['description'] = t('Includes the following stream wrappers: %wrappers.', array('%wrappers' => implode(', ', $wrappers['private'])));

  // Generate standard file permissions for all applicable file types.
  foreach (file_permissions_get_configured_types() as $type) {
    $permissions += file_list_permissions($type);

  return $permissions;