Create your own permission in drupal
I need to know how to add a new permission in drupal, for example in drupal, when I edit the role permissions, I choose the permission administer filters
to grant it, so I need a new permission, for example Allow preauthorized tickets
for my own application, how can I add it to the list. which should be given to any role.
Any advice would be helpful to me.
+3
source to share
2 answers
You need to implement hook_perm()
in your custom module:
function MYMODULE_perm() {
return array('allow preauthorized tickets');
}
+2
source to share
As a link in Drupal 7, this changed to hook_permission()
:
function hook_permission() {
return array(
'administer my module' => array(
'title' => t('Administer my module'),
'description' => t('Perform administration tasks for my module.'),
),
);
}
You can find an example implementation here .
+8
source to share