Same name and namespace in other branches
  1. 4.6.x developer/hooks/core.php \hook_perm()
  2. 4.7.x developer/hooks/core.php \hook_perm()
  3. 5.x developer/hooks/core.php \hook_perm()

Define user permissions.

This hook can supply permissions that the module defines, so that they can be selected on the user permissions page and used to grant or restrict access to actions the module performs.

Permissions are checked using user_access().

For a detailed usage example, see page_example.module.

Return value

An array of permission strings. The strings must not be wrapped with the t() function, since the string extractor takes care of extracting permission names defined in the perm hook for translation.

Related topics

23 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.

aggregator_perm in modules/aggregator/aggregator.module
Implementation of hook_perm().
block_perm in modules/block/block.module
Implementation of hook_perm().
blogapi_perm in modules/blogapi/blogapi.module
Implementation of hook_perm().
blog_perm in modules/blog/blog.module
Implementation of hook_perm().
book_perm in modules/book/book.module
Implementation of hook_perm().

... See full list

File

developer/hooks/core.php, line 1748
These are the hooks that are invoked by the Drupal core.

Code

function hook_perm() {
  return array(
    'administer my module',
  );
}