From 56f6522dcfd33d40f3725d162729b2fe6a132a00 Mon Sep 17 00:00:00 2001 From: Andrew Hunt Date: Mon, 30 Mar 2015 12:37:05 -0400 Subject: [PATCH] CRM-16201 display permission descriptions in WordPress --- CRM/ACL/Form/WordPress/Permissions.php | 15 +++++++++++++-- templates/CRM/ACL/Form/WordPress/Permissions.tpl | 5 ++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CRM/ACL/Form/WordPress/Permissions.php b/CRM/ACL/Form/WordPress/Permissions.php index b3dc310ad1..1f4721cbc4 100644 --- a/CRM/ACL/Form/WordPress/Permissions.php +++ b/CRM/ACL/Form/WordPress/Permissions.php @@ -49,6 +49,7 @@ class CRM_ACL_Form_WordPress_Permissions extends CRM_Core_Form { // Get the core permissions array $permissionsArray = self::getPermissionArray(); + $permissionsDesc = self::getPermissionArray(TRUE); // Get the wordpress roles, default capabilities and assign to the form // TODO: Create a new wordpress role (Anonymous user) and define capabilities in Wordpress Access Control @@ -81,6 +82,13 @@ class CRM_ACL_Form_WordPress_Permissions extends CRM_Core_Form { $this->setDefaults($defaults); + $descArray = array(); + foreach ($permissionsDesc as $perm => $attr) { + if (count($attr) > 1) { + $descArray[$perm] = $attr[1]; + } + } + $this->assign('permDesc', $descArray); $this->assign('rolePerms', $rolePerms); $this->assign('roles', $roles); @@ -173,13 +181,16 @@ class CRM_ACL_Form_WordPress_Permissions extends CRM_Core_Form { * This function should be shared from a similar one in * distmaker/utils/joomlaxml.php * + * @param bool $descriptions + * Whether to return permission descriptions + * * @return array * civicrm permissions */ - public static function getPermissionArray() { + public static function getPermissionArray($descriptions = FALSE) { global $civicrm_root; - $permissions = CRM_Core_Permission::basicPermissions(); + $permissions = CRM_Core_Permission::basicPermissions(FALSE, $descriptions); $perms_array = array(); foreach ($permissions as $perm => $title) { diff --git a/templates/CRM/ACL/Form/WordPress/Permissions.tpl b/templates/CRM/ACL/Form/WordPress/Permissions.tpl index c700e53c4e..f1f383d89e 100644 --- a/templates/CRM/ACL/Form/WordPress/Permissions.tpl +++ b/templates/CRM/ACL/Form/WordPress/Permissions.tpl @@ -48,9 +48,12 @@ {else} {/if} - + {if $i eq 1} {$form.$role_name.$name.label} + {if $permDesc.$name} +
{$permDesc.$name} + {/if} {/if} {$form.$role_name.$name.html}
-- 2.25.1