How should custom permissions created by hook_civicrm_permission be properly checked?
Have defined custom permission like this:
function mymodulename_civicrm_permission(&$permissions) {
$prefix = ts('SpecialPermissions') . ': '; // name of extension or module
$permissions['SpecialPermissions'] = $prefix . ts('SpecialPermissions');
}
and checking it later on, same module, hook_civicrm_buildForm, have tried every option listed below:
* if (CRM_Core_Permission::check('SpecialPermissions')) {
* if (CRM_Core_Permission::check('Drupal: SpecialPermissions')) {
* if (CRM_Core_Permission::check('CiviCRM: SpecialPermissions')) {
* if (CRM_Core_Permission::check('cms: SpecialPermissions')) {
Code looks like exactly according to specs from: * http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_permission * http://wiki.civicrm.org/confluence/display/CRMDOC/Permission+Reference
However, both test user with a corresponded permission AND Drupal user 1 (UID=1) are being affected, even when Drupal User 1 doesn't have role with custom permissions attached. Not sure if it is by design or something wrong with my implementation of this? Please advice.