From a0956f3ca8a0b341a48dc0b799b50f5018dcd82e Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 4 Mar 2021 02:17:01 -0800 Subject: [PATCH] authx - Declare setting "authx_guards" --- ext/authx/Civi/Authx/Meta.php | 10 ++++++++++ ext/authx/settings/authx.setting.php | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/ext/authx/Civi/Authx/Meta.php b/ext/authx/Civi/Authx/Meta.php index 9e5915cec9..fa4a1e6181 100644 --- a/ext/authx/Civi/Authx/Meta.php +++ b/ext/authx/Civi/Authx/Meta.php @@ -28,6 +28,16 @@ class Meta { ]; } + /** + * @return array + */ + public static function getGuardTypes() { + return [ + 'perm' => E::ts('User Permission'), + 'site_key' => E::ts('Site Key'), + ]; + } + /** * @return array */ diff --git a/ext/authx/settings/authx.setting.php b/ext/authx/settings/authx.setting.php index e40bfc8233..5613bb2f06 100644 --- a/ext/authx/settings/authx.setting.php +++ b/ext/authx/settings/authx.setting.php @@ -27,6 +27,22 @@ $_authx_settings = function() { ]; $s = []; + $s["authx_guards"] = $basic + [ + 'name' => 'authx_guards', + 'type' => 'Array', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', + 'html_attributes' => [ + 'multiple' => 1, + 'class' => 'crm-select2', + ], + 'default' => ['site_key', 'perm'], + 'title' => ts('Authentication guard'), + 'help_text' => ts('Enable an authentication guard if you want to limit which users may authenticate via authx. The permission-based guard is satisfied by checking user permissions. The key-based guard is satisfied by checking the secret site-key. The JWT guard is satisfied if the user presents a signed token. If there are no guards, then any user can authenticate.'), + 'pseudoconstant' => [ + 'callback' => ['\Civi\Authx\Meta', 'getGuardTypes'], + ], + ]; foreach ($flows as $flow) { $s["authx_{$flow}_cred"] = $basic + [ 'name' => "authx_{$flow}_cred", -- 2.25.1