From: Andrew Hunt Date: Tue, 31 Mar 2015 15:06:33 +0000 (-0400) Subject: CRM-16201 permissions: add descriptions and make translatable X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=221b21b4af3f804ee1b07f7f4ca062f89bbd47ac;p=civicrm-core.git CRM-16201 permissions: add descriptions and make translatable --- diff --git a/CRM/Campaign/Info.php b/CRM/Campaign/Info.php index 3cbaf481b3..688ce1676f 100644 --- a/CRM/Campaign/Info.php +++ b/CRM/Campaign/Info.php @@ -60,19 +60,49 @@ class CRM_Campaign_Info extends CRM_Core_Component_Info { /** * @inheritDoc * @param bool $getAllUnconditionally + * @param bool $descriptions + * Whether to return permission descriptions * * @return array */ - public function getPermissions($getAllUnconditionally = FALSE) { - return array( - 'administer CiviCampaign', - 'manage campaign', - 'reserve campaign contacts', - 'release campaign contacts', - 'interview campaign contacts', - 'gotv campaign contacts', - 'sign CiviCRM Petition', + public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) { + $permissions = array( + 'administer CiviCampaign' => array( + ts('administer CiviCampaign'), + ts('Create new campaign, survey and petition types and their status'), + ), + 'manage campaign' => array( + ts('manage campaign'), + ts('Create new campaigns, surveys and petitions, reserve respondents'), + ), + 'reserve campaign contacts' => array( + ts('reserve campaign contacts'), + ts('Reserve campaign contacts for surveys and petitions'), + ), + 'release campaign contacts' => array( + ts('release campaign contacts'), + ts('Release reserved campaign contacts for surveys and petitions'), + ), + 'interview campaign contacts' => array( + ts('interview campaign contacts'), + ts('Record survey and petition responses from their reserved contacts'), + ), + 'gotv campaign contacts' => array( + ts('GOTV campaign contacts'), + ts('Record that contacts voted'), + ), + 'sign CiviCRM Petition' => array( + ts('sign CiviCRM Petition'), + ), ); + + if (!$descriptions) { + foreach ($permissions as $name => $attr) { + $permissions[$name] = array_shift($attr); + } + } + + return $permissions; } diff --git a/CRM/Case/Info.php b/CRM/Case/Info.php index 4360ad4fae..655369006e 100644 --- a/CRM/Case/Info.php +++ b/CRM/Case/Info.php @@ -94,17 +94,38 @@ class CRM_Case_Info extends CRM_Core_Component_Info { /** * @inheritDoc * @param bool $getAllUnconditionally + * @param bool $descriptions + * Whether to return permission descriptions * * @return array */ - public function getPermissions($getAllUnconditionally = FALSE) { - return array( - 'delete in CiviCase', - 'administer CiviCase', - 'access my cases and activities', - 'access all cases and activities', - 'add cases', + public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) { + $permissions = array( + 'delete in CiviCase' => array( + ts('delete in CiviCase'), + ts('Delete Cases'), + ), + 'administer CiviCase' => array( + ts('administer CiviCase'), + ), + 'access my cases and activities' => array( + ts('access my cases and activities'), + ), + 'access all cases and activities' => array( + ts('access all cases and activities'), + ), + 'add cases' => array( + ts('add cases'), + ), ); + + if (!$descriptions) { + foreach ($permissions as $name => $attr) { + $permissions[$name] = array_shift($attr); + } + } + + return $permissions; } /** diff --git a/CRM/Contribute/Info.php b/CRM/Contribute/Info.php index 940c5ba381..7958d8b877 100644 --- a/CRM/Contribute/Info.php +++ b/CRM/Contribute/Info.php @@ -75,6 +75,8 @@ class CRM_Contribute_Info extends CRM_Core_Component_Info { * implementation of $getAllUnconditionally is required. * * @param bool $getAllUnconditionally + * @param bool $descriptions + * Whether to return permission descriptions * * @return array|null * collection of permissions, null if none @@ -84,13 +86,32 @@ class CRM_Contribute_Info extends CRM_Core_Component_Info { * * @return array|null */ - public function getPermissions($getAllUnconditionally = FALSE) { - return array( - 'access CiviContribute', - 'edit contributions', - 'make online contributions', - 'delete in CiviContribute', + public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) { + $permissions = array( + 'access CiviContribute' => array( + ts('access CiviContribute'), + ts('Record backend contributions (with edit contributions) and view all contributions (for visible contacts)'), + ), + 'edit contributions' => array( + ts('edit contributions'), + ts('Record and update contributions'), + ), + 'make online contributions' => array( + ts('make online contributions'), + ), + 'delete in CiviContribute' => array( + ts('delete in CiviContribute'), + ts('Delete contributions'), + ), ); + + if (!$descriptions) { + foreach ($permissions as $name => $attr) { + $permissions[$name] = array_shift($attr); + } + } + + return $permissions; } /** diff --git a/CRM/Core/Permission.php b/CRM/Core/Permission.php index 2b6ef9d5ef..b56d805b3d 100644 --- a/CRM/Core/Permission.php +++ b/CRM/Core/Permission.php @@ -547,43 +547,77 @@ class CRM_Core_Permission { /** * @param bool $all + * @param bool $descriptions + * whether to return descriptions * * @return array */ - public static function &basicPermissions($all = FALSE) { - static $permissions = NULL; + public static function &basicPermissions($all = FALSE, $descriptions = FALSE) { + if ($descriptions) { + static $permissionsDesc = NULL; - if (!$permissions) { - $config = CRM_Core_Config::singleton(); - $prefix = ts('CiviCRM') . ': '; - $permissions = self::getCorePermissions(); - - if (self::isMultisiteEnabled()) { - $permissions['administer Multiple Organizations'] = $prefix . ts('administer Multiple Organizations'); + if (!$permissionsDesc) { + $permissionsDesc = self::assembleBasicPermissions($all, $descriptions); } - if (!$all) { - $components = CRM_Core_Component::getEnabledComponents(); - } - else { - $components = CRM_Core_Component::getComponents(); + return $permissionsDesc; + } + else { + static $permissions = NULL; + + if (!$permissions) { + $permissions = self::assembleBasicPermissions($all, $descriptions); } - foreach ($components as $comp) { - $perm = $comp->getPermissions(); - if ($perm) { - $info = $comp->getInfo(); + return $permissions; + } + } + + /** + * @param bool $all + * @param bool $descriptions + * whether to return descriptions + * + * @return array + */ + public static function assembleBasicPermissions($all = FALSE, $descriptions = FALSE) { + $config = CRM_Core_Config::singleton(); + $prefix = ts('CiviCRM') . ': '; + $permissions = self::getCorePermissions($descriptions); + + if (self::isMultisiteEnabled()) { + $permissions['administer Multiple Organizations'] = $prefix . ts('administer Multiple Organizations'); + } + + if (!$all) { + $components = CRM_Core_Component::getEnabledComponents(); + } + else { + $components = CRM_Core_Component::getComponents(); + } + + foreach ($components as $comp) { + $perm = $comp->getPermissions(FALSE, $descriptions); + if ($perm) { + $info = $comp->getInfo(); + if ($descriptions) { + foreach ($perm as $p => $attr) { + $title = $info['translatedName'] . ': ' . array_shift($attr); + array_unshift($attr, $title); + $permissions[$p] = $attr; + } + } + else { foreach ($perm as $p) { $permissions[$p] = $info['translatedName'] . ': ' . $p; } } } - - // Add any permissions defined in hook_civicrm_permission implementations. - $module_permissions = $config->userPermissionClass->getAllModulePermissions(); - $permissions = array_merge($permissions, $module_permissions); } + // Add any permissions defined in hook_civicrm_permission implementations. + $module_permissions = $config->userPermissionClass->getAllModulePermissions(); + $permissions = array_merge($permissions, $module_permissions); return $permissions; } @@ -617,56 +651,185 @@ class CRM_Core_Permission { } /** + * @param bool $descriptions + * whether to return descriptions + * * @return array */ - public static function getCorePermissions() { + public static function getCorePermissions($descriptions = FALSE) { $prefix = ts('CiviCRM') . ': '; $permissions = array( - 'add contacts' => $prefix . ts('add contacts'), - 'view all contacts' => $prefix . ts('view all contacts'), - 'edit all contacts' => $prefix . ts('edit all contacts'), - 'view my contact' => $prefix . ts('view my contact'), - 'edit my contact' => $prefix . ts('edit my contact'), - 'delete contacts' => $prefix . ts('delete contacts'), - 'access deleted contacts' => $prefix . ts('access deleted contacts'), - 'import contacts' => $prefix . ts('import contacts'), - 'edit groups' => $prefix . ts('edit groups'), - 'administer CiviCRM' => $prefix . ts('administer CiviCRM'), - 'skip IDS check' => $prefix . ts('skip IDS check'), - 'access uploaded files' => $prefix . ts('access uploaded files'), - 'profile listings and forms' => $prefix . ts('profile listings and forms'), - 'profile listings' => $prefix . ts('profile listings'), - 'profile create' => $prefix . ts('profile create'), - 'profile edit' => $prefix . ts('profile edit'), - 'profile view' => $prefix . ts('profile view'), - 'access all custom data' => $prefix . ts('access all custom data'), - 'view all activities' => $prefix . ts('view all activities'), - 'delete activities' => $prefix . ts('delete activities'), - 'access CiviCRM' => $prefix . ts('access CiviCRM'), - 'access Contact Dashboard' => $prefix . ts('access Contact Dashboard'), - 'translate CiviCRM' => $prefix . ts('translate CiviCRM'), - 'administer reserved groups' => $prefix . ts('administer reserved groups'), - 'administer Tagsets' => $prefix . ts('administer Tagsets'), - 'administer reserved tags' => $prefix . ts('administer reserved tags'), - 'administer dedupe rules' => $prefix . ts('administer dedupe rules'), - 'merge duplicate contacts' => $prefix . ts('merge duplicate contacts'), - 'view debug output' => $prefix . ts('view debug output'), - 'view all notes' => $prefix . ts('view all notes'), - 'access AJAX API' => $prefix . ts('access AJAX API'), - 'access contact reference fields' => $prefix . ts('access contact reference fields'), - 'create manual batch' => $prefix . ts('create manual batch'), - 'edit own manual batches' => $prefix . ts('edit own manual batches'), - 'edit all manual batches' => $prefix . ts('edit all manual batches'), - 'view own manual batches' => $prefix . ts('view own manual batches'), - 'view all manual batches' => $prefix . ts('view all manual batches'), - 'delete own manual batches' => $prefix . ts('delete own manual batches'), - 'delete all manual batches' => $prefix . ts('delete all manual batches'), - 'export own manual batches' => $prefix . ts('export own manual batches'), - 'export all manual batches' => $prefix . ts('export all manual batches'), - 'administer payment processors' => $prefix . ts('administer payment processors'), - 'edit message templates' => $prefix . ts('edit message templates'), + 'add contacts' => array( + $prefix . ts('add contacts'), + ts('Create a new contact record in CiviCRM'), + ), + 'view all contacts' => array( + $prefix . ts('view all contacts'), + ts('View ANY CONTACT in the CiviCRM database, export contact info and perform activities such as Send Email, Phone Call, etc.'), + ), + 'edit all contacts' => array( + $prefix . ts('edit all contacts'), + ts('View, Edit and Delete ANY CONTACT in the CiviCRM database; Create and edit relationships, tags and other info about the contacts'), + ), + 'view my contact' => array( + $prefix . ts('view my contact'), + ), + 'edit my contact' => array( + $prefix . ts('edit my contact'), + ), + 'delete contacts' => array( + $prefix . ts('delete contacts'), + ), + 'access deleted contacts' => array( + $prefix . ts('access deleted contacts'), + ts('Access contacts in the trash'), + ), + 'import contacts' => array( + $prefix . ts('import contacts'), + ts('Import contacts and activities'), + ), + 'edit groups' => array( + $prefix . ts('edit groups'), + ts('Create new groups, edit group settings (e.g. group name, visibility...), delete groups'), + ), + 'administer CiviCRM' => array( + $prefix . ts('administer CiviCRM'), + ts('Perform all tasks in the Administer CiviCRM control panel and Import Contacts'), + ), + 'skip IDS check' => array( + $prefix . ts('skip IDS check'), + ts('IDS system is bypassed for users with this permission. Prevents false errors for admin users.'), + ), + 'access uploaded files' => array( + $prefix . ts('access uploaded files'), + ts('View / download files including images and photos'), + ), + 'profile listings and forms' => array( + $prefix . ts('profile listings and forms'), + ts('Access the profile Search form and listings'), + ), + 'profile listings' => array( + $prefix . ts('profile listings'), + ), + 'profile create' => array( + $prefix . ts('profile create'), + ts('Use profiles in Create mode'), + ), + 'profile edit' => array( + $prefix . ts('profile edit'), + ts('Use profiles in Edit mode'), + ), + 'profile view' => array( + $prefix . ts('profile view'), + ), + 'access all custom data' => array( + $prefix . ts('access all custom data'), + ts('View all custom fields regardless of ACL rules'), + ), + 'view all activities' => array( + $prefix . ts('view all activities'), + ts('View all activities (for visible contacts)'), + ), + 'delete activities' => array( + $prefix . ts('Delete activities'), + ), + 'access CiviCRM' => array( + $prefix . ts('access CiviCRM'), + ts('Master control for access to the main CiviCRM backend and API'), + ), + 'access Contact Dashboard' => array( + $prefix . ts('access Contact Dashboard'), + ts('View Contact Dashboard (for themselves and visible contacts)'), + ), + 'translate CiviCRM' => array( + $prefix . ts('translate CiviCRM'), + ts('Allow User to enable multilingual'), + ), + 'administer reserved groups' => array( + $prefix . ts('administer reserved groups'), + ts('Edit and disable Reserved Groups (Needs Edit Groups)'), + ), + 'administer Tagsets' => array( + $prefix . ts('administer Tagsets'), + ), + 'administer reserved tags' => array( + $prefix . ts('administer reserved tags'), + ), + 'administer dedupe rules' => array( + $prefix . ts('administer dedupe rules'), + ts('Create and edit rules, change the supervised and unsupervised rules'), + ), + 'merge duplicate contacts' => array( + $prefix . ts('merge duplicate contacts'), + ts('Delete Contacts must also be granted in order for this to work.'), + ), + 'view debug output' => array( + $prefix . ts('view debug output'), + ts('View results of debug and backtrace'), + ), + 'view all notes' => array( + $prefix . ts('view all notes'), + ts("View notes (for visible contacts) even if they're marked admin only"), + ), + 'access AJAX API' => array( + $prefix . ts('access AJAX API'), + ts('Allow API access even if Access CiviCRM is not granted'), + ), + 'access contact reference fields' => array( + $prefix . ts('access contact reference fields'), + ts('Allow entering data into contact reference fields'), + ), + 'create manual batch' => array( + $prefix . ts('create manual batch'), + ts('Create an accounting batch (with Access to CiviContribute and View Own/All Manual Batches)'), + ), + 'edit own manual batches' => array( + $prefix . ts('edit own manual batches'), + ts('Edit accounting batches created by user'), + ), + 'edit all manual batches' => array( + $prefix . ts('edit all manual batches'), + ts('Edit all accounting batches'), + ), + 'view own manual batches' => array( + $prefix . ts('view own manual batches'), + ts('View accounting batches created by user (with Access to CiviContribute)'), + ), + 'view all manual batches' => array( + $prefix . ts('view all manual batches'), + ts('View all accounting batches (with Access to CiviContribute)'), + ), + 'delete own manual batches' => array( + $prefix . ts('delete own manual batches'), + ts('Delete accounting batches created by user'), + ), + 'delete all manual batches' => array( + $prefix . ts('delete all manual batches'), + ts('Delete all accounting batches'), + ), + 'export own manual batches' => array( + $prefix . ts('export own manual batches'), + ts('Export accounting batches created by user'), + ), + 'export all manual batches' => array( + $prefix . ts('export all manual batches'), + ts('Export all accounting batches'), + ), + 'administer payment processors' => array( + $prefix . ts('administer payment processors'), + ts('Add, Update, or Disable Payment Processors'), + ), + 'edit message templates' => array( + $prefix . ts('edit message templates'), + ), ); + if (!$descriptions) { + foreach ($permissions as $name => $attr) { + $permissions[$name] = array_shift($attr); + } + } + return $permissions; } diff --git a/CRM/Event/Info.php b/CRM/Event/Info.php index 756e8f662e..398e3fc72a 100644 --- a/CRM/Event/Info.php +++ b/CRM/Event/Info.php @@ -59,19 +59,49 @@ class CRM_Event_Info extends CRM_Core_Component_Info { /** * @inheritDoc * @param bool $getAllUnconditionally + * @param bool $descriptions + * Whether to return permission descriptions * * @return array */ - public function getPermissions($getAllUnconditionally = FALSE) { - return array( - 'access CiviEvent', - 'edit event participants', - 'edit all events', - 'register for events', - 'view event info', - 'view event participants', - 'delete in CiviEvent', + public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) { + $permissions = array( + 'access CiviEvent' => array( + ts('access CiviEvent'), + ts('Create events, view all events, and view participant records (for visible contacts)'), + ), + 'edit event participants' => array( + ts('edit event participants'), + ts('Record and update backend event registrations'), + ), + 'edit all events' => array( + ts('edit all events'), + ts('Edit events even without specific ACL granted'), + ), + 'register for events' => array( + ts('register for events'), + ts('Register for events online'), + ), + 'view event info' => array( + ts('view event info'), + ts('View online event information pages'), + ), + 'view event participants' => array( + ts('view event participants'), + ), + 'delete in CiviEvent' => array( + ts('delete in CiviEvent'), + ts('Delete participants and events that you can edit'), + ), ); + + if (!$descriptions) { + foreach ($permissions as $name => $attr) { + $permissions[$name] = array_shift($attr); + } + } + + return $permissions; } /** diff --git a/CRM/Grant/Info.php b/CRM/Grant/Info.php index 45d93e6b26..6c97555e17 100644 --- a/CRM/Grant/Info.php +++ b/CRM/Grant/Info.php @@ -61,15 +61,34 @@ class CRM_Grant_Info extends CRM_Core_Component_Info { /** * @inheritDoc * @param bool $getAllUnconditionally + * @param bool $descriptions + * Whether to return permission descriptions * * @return array */ - public function getPermissions($getAllUnconditionally = FALSE) { - return array( - 'access CiviGrant', - 'edit grants', - 'delete in CiviGrant', + public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) { + $permissions = array( + 'access CiviGrant' => array( + ts('access CiviGrant'), + ts('View all grants'), + ), + 'edit grants' => array( + ts('edit grants'), + ts('Create and update grants'), + ), + 'delete in CiviGrant' => array( + ts('delete in CiviGrant'), + ts('Delete grants'), + ), ); + + if (!$descriptions) { + foreach ($permissions as $name => $attr) { + $permissions[$name] = array_shift($attr); + } + } + + return $permissions; } /** diff --git a/CRM/Mailing/Info.php b/CRM/Mailing/Info.php index b3eef8170d..9fdcf6c615 100644 --- a/CRM/Mailing/Info.php +++ b/CRM/Mailing/Info.php @@ -210,21 +210,51 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { /** * @inheritDoc * @param bool $getAllUnconditionally + * @param bool $descriptions + * Whether to return permission descriptions * * @return array */ - public function getPermissions($getAllUnconditionally = FALSE) { + public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) { $permissions = array( - 'access CiviMail', - 'access CiviMail subscribe/unsubscribe pages', - 'delete in CiviMail', - 'view public CiviMail content', + 'access CiviMail' => array( + ts('access CiviMail'), + ), + 'access CiviMail subscribe/unsubscribe pages' => array( + ts('access CiviMail subscribe/unsubscribe pages'), + ts('Subscribe/unsubscribe from mailing list group'), + ), + 'delete in CiviMail' => array( + ts('delete in CiviMail'), + ts('Delete Mailing'), + ), + 'view public CiviMail content' => array( + ts('view public CiviMail content'), + ), ); if (self::workflowEnabled() || $getAllUnconditionally) { - $permissions[] = 'create mailings'; - $permissions[] = 'schedule mailings'; - $permissions[] = 'approve mailings'; + $permissions[] = array( + 'create mailings' => array( + ts('create mailings'), + ), + ); + $permissions[] = array( + 'schedule mailings' => array( + ts('schedule mailings'), + ), + ); + $permissions[] = array( + 'approve mailings' => array( + ts('approve mailings'), + ), + ); + } + + if (!$descriptions) { + foreach ($permissions as $name => $attr) { + $permissions[$name] = array_shift($attr); + } } return $permissions; diff --git a/CRM/Member/Info.php b/CRM/Member/Info.php index 76bc4f4c23..96c7fbcf06 100644 --- a/CRM/Member/Info.php +++ b/CRM/Member/Info.php @@ -75,21 +75,35 @@ class CRM_Member_Info extends CRM_Core_Component_Info { * implementation of $getAllUnconditionally is required. * * @param bool $getAllUnconditionally + * @param bool $descriptions + * Whether to return permission descriptions * * @return array|null * collection of permissions, null if none */ - /** - * @param bool $getAllUnconditionally - * - * @return array|null - */ - public function getPermissions($getAllUnconditionally = FALSE) { - return array( - 'access CiviMember', - 'edit memberships', - 'delete in CiviMember', + public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) { + $permissions = array( + 'access CiviMember' => array( + ts('access CiviMember'), + ts('View memberships'), + ), + 'edit memberships' => array( + ts('edit memberships'), + ts('Create and update memberships'), + ), + 'delete in CiviMember' => array( + ts('delete in CiviMember'), + ts('Delete memberships'), + ), ); + + if (!$descriptions) { + foreach ($permissions as $name => $attr) { + $permissions[$name] = array_shift($attr); + } + } + + return $permissions; } /** diff --git a/CRM/Pledge/Info.php b/CRM/Pledge/Info.php index 2d6ea2103c..3aff707b18 100644 --- a/CRM/Pledge/Info.php +++ b/CRM/Pledge/Info.php @@ -71,21 +71,35 @@ class CRM_Pledge_Info extends CRM_Core_Component_Info { * implementation of $getAllUnconditionally is required. * * @param bool $getAllUnconditionally + * @param bool $descriptions + * Whether to return permission descriptions * * @return array|null * collection of permissions, null if none */ - /** - * @param bool $getAllUnconditionally - * - * @return array|null - */ - public function getPermissions($getAllUnconditionally = FALSE) { - return array( - 'access CiviPledge', - 'edit pledges', - 'delete in CiviPledge', + public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) { + $permissions = array( + 'access CiviPledge' => array( + ts('access CiviPledge'), + ts('View pledges'), + ), + 'edit pledges' => array( + ts('edit pledges'), + ts('Create and update pledges'), + ), + 'delete in CiviPledge' => array( + ts('delete in CiviPledge'), + ts('Delete pledges'), + ), ); + + if (!$descriptions) { + foreach ($permissions as $name => $attr) { + $permissions[$name] = array_shift($attr); + } + } + + return $permissions; } /** diff --git a/CRM/Report/Info.php b/CRM/Report/Info.php index d79d779f0e..e19da69d1a 100644 --- a/CRM/Report/Info.php +++ b/CRM/Report/Info.php @@ -75,17 +75,39 @@ class CRM_Report_Info extends CRM_Core_Component_Info { * implementation of $getAllUnconditionally is required. * * @param bool $getAllUnconditionally + * @param bool $descriptions + * Whether to return permission descriptions * * @return array|null * collection of permissions, null if none */ - /** - * @param bool $getAllUnconditionally - * - * @return array|null - */ - public function getPermissions($getAllUnconditionally = FALSE) { - return array('access CiviReport', 'access Report Criteria', 'administer reserved reports', 'administer Reports'); + public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) { + $permissions = array( + 'access CiviReport' => array( + ts('access CiviReport'), + ts('View reports'), + ), + 'access Report Criteria' => array( + ts('access Report Criteria'), + ts('Change report search criteria'), + ), + 'administer reserved reports' => array( + ts('administer reserved reports'), + ts('Edit all reports that have been marked as reserved'), + ), + 'administer Reports' => array( + ts('administer Reports'), + ts('Manage report templates'), + ), + ); + + if (!$descriptions) { + foreach ($permissions as $name => $attr) { + $permissions[$name] = array_shift($attr); + } + } + + return $permissions; }