hook_perm

Versions
4.6 – 6
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

Code

developer/hooks/core.php, line 1491

<?php
function hook_perm() {
  return array('administer my module');
}
?>

hook_permission() in Drupal 7

joachim - Sun, 2009-09-13 12:54

For the Drupal 7 version of this hook see http://api.drupal.org/api/function/hook_permission/7

Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.