From c4e6b41363a9d6c5be1c95755235840d355e2c04 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 3 Dec 2020 21:51:57 -0800 Subject: [PATCH] Afform - Export list of synthetic permissions --- ext/afform/core/afform.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ext/afform/core/afform.php b/ext/afform/core/afform.php index a5c4584849..49b3ba9f99 100644 --- a/ext/afform/core/afform.php +++ b/ext/afform/core/afform.php @@ -542,6 +542,23 @@ function afform_civicrm_permission_check($permission, &$granted, $contactId) { } } +/** + * Implements hook_civicrm_permissionList(). + * + * @see CRM_Utils_Hook::permissionList() + */ +function afform_civicrm_permissionList(&$permissions) { + $scanner = Civi::service('afform_scanner'); + foreach ($scanner->getMetas() as $name => $meta) { + $permissions['@afform:' . $name] = [ + 'group' => 'afform', + 'title' => ts('Afform: Inherit permission of %1', [ + 1 => $name, + ]), + ]; + } +} + /** * Clear any local/in-memory caches based on afform data. */ -- 2.25.1