Afform - Export list of synthetic permissions
authorTim Otten <totten@civicrm.org>
Fri, 4 Dec 2020 05:51:57 +0000 (21:51 -0800)
committerTim Otten <totten@civicrm.org>
Wed, 9 Dec 2020 22:24:59 +0000 (14:24 -0800)
ext/afform/core/afform.php

index a5c4584849044b3bf09ba13f492327441cc210ec..49b3ba9f9977a3ed085f98e7e5e955a7fc2baff8 100644 (file)
@@ -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.
  */