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.", );

See also

hook_menu()

user_has_permission()

12 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
announcements_perm in modules/announcements/announcements.module
Implementation of hook_perm
blocks_perm in modules/blocks/blocks.module
comments_perm in modules/comments/comments.module

... See full list

File

includes/hook.api.php, line 326
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."),
    ),

    "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."),
    ),

  );

  return $perms;
}