Same name and namespace in other branches
  1. 4.6.x developer/hooks/core.php \hook_perm()
  2. 5.x developer/hooks/core.php \hook_perm()
  3. 6.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 restrict access to actions the module performs.

Return value

An array of permissions strings.

Permissions are checked using user_access().

For a detailed usage example, see page_example.module.

Related topics

26 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.module
Implementation of hook_perm().
block_perm in modules/block.module
Implementation of hook_perm().
blog_perm in modules/blog.module
Implementation of hook_perm().
book_perm in modules/book.module
Implementation of hook_perm().
comment_perm in modules/comment.module
Implementation of hook_perm().

... See full list

File

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

Code

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