function hook_perm

This hook defines available permissions for a module. These perms are used with hook_menu() and the function user_has_permission()

They are defined in the form of an associative array.

Return array should look like this: $rtn["machine_name_of_perm"] = array( "title" => "Human readable title for perm", "description" => "Optional longer description of what perm allows.", "admin_restricted" => FALSE, // Optional. If TRUE, only admin (user_id 1) can grant this permission to other roles. );

See also

hook_menu()

user_has_permission()

22 functions implement hook_perm()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

admin_perm in modules/admin/admin.module
advise_perm in modules/advise/advise.module
Implementation of hook_perm
alerts_perm in modules/alerts/alerts.module
announcements_perm in modules/announcements/announcements.module
Implementation of hook_perm
audit_perm in modules/audit/audit.module
Implementation of hook_perm

... See full list

File

includes/hook.api.php, line 624
Lists all available hooks within FlightPath's core code.

Code

function hook_perm() {
  // An example from system.module:

  $perms = array(
    "access_logged_in_content" => array(
      "title" => t("Access logged-in content"),
      "description" => t("This should be given to all authenticated users.  It simply means
                          the user is allowed to view the logged-in area of FlightPath."),
    ),

    "administer_modules" => array(
      "title" => t("Administer modules"),
      "description" => t("This will allow a user to install, enable, disable, and uninstall modules."),
      "admin_restricted" => TRUE, // means only appears for admin (user_id == 1)
    ),

    "run_cron" => array(
      "title" => t("Run Cron"),
      "description" => t("The user may run hook_cron functions at will. Causes a new menu link to appear
                          on the admin page."),
    ),

    "de_can_administer_system_settings" => array(
      "title" => t("Can administer system settings"),
      "description" => t("This allows the user to edit any of the FlightPath
                        system settings."),
    ),

    "view_fpm_debug" => array(
      "title" => t("View debug output from the fpm() function"),
      "description" => t("The user may view debug output from the fpm() function.
                        Useful for developers."),
      "admin_restricted" => TRUE, // means only appears for admin (user_id == 1)
    ),

  );

  return $perms;
}