From 8529e85a984d6a3d8b18c99692ebfbf65ca9961b Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 10 Apr 2023 21:43:06 -0700 Subject: [PATCH] authx - Rename new permission (generate JWT => generate any authx credential) --- ext/authx/Civi/Api4/AuthxCredential.php | 2 +- ext/authx/authx.php | 2 +- ext/authx/tests/phpunit/api/v4/AuthxCredentialTest.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/authx/Civi/Api4/AuthxCredential.php b/ext/authx/Civi/Api4/AuthxCredential.php index b700a3fc9e..74b5d46902 100644 --- a/ext/authx/Civi/Api4/AuthxCredential.php +++ b/ext/authx/Civi/Api4/AuthxCredential.php @@ -52,7 +52,7 @@ class AuthxCredential extends Generic\AbstractEntity { return [ 'meta' => ['access CiviCRM'], 'default' => ['administer CiviCRM'], - 'create' => ['generate JWT'], + 'create' => ['generate any authx credential'], 'validate' => [], ]; } diff --git a/ext/authx/authx.php b/ext/authx/authx.php index e79ffcf634..c6f349ac27 100644 --- a/ext/authx/authx.php +++ b/ext/authx/authx.php @@ -124,7 +124,7 @@ function authx_civicrm_enable() { function authx_civicrm_permission(&$permissions) { $permissions['authenticate with password'] = E::ts('AuthX: Authenticate to services with password'); $permissions['authenticate with api key'] = E::ts('AuthX: Authenticate to services with API key'); - $permissions['generate JWT'] = E::ts('Authx: Permit the generation of JWTs via the API'); + $permissions['generate any authx credential'] = E::ts('Authx: Generate new JWT credentials for other users via the API'); } // --- Functions below this ship commented out. Uncomment as required. --- diff --git a/ext/authx/tests/phpunit/api/v4/AuthxCredentialTest.php b/ext/authx/tests/phpunit/api/v4/AuthxCredentialTest.php index 87dc8e15e7..907f618b3d 100644 --- a/ext/authx/tests/phpunit/api/v4/AuthxCredentialTest.php +++ b/ext/authx/tests/phpunit/api/v4/AuthxCredentialTest.php @@ -38,7 +38,7 @@ class AuthxCredentialTest extends TestCase implements HeadlessInterface, Transac } $this->setPermissions([ 'access CiviCRM', - 'generate JWT', + 'generate any authx credential', ]); $jwt = AuthxCredential::create()->setContactId($contactRecord['id'])->execute(); $this->assertNotEmpty($jwt[0]['token']); @@ -50,7 +50,7 @@ class AuthxCredentialTest extends TestCase implements HeadlessInterface, Transac $this->createLoggedInUser(); $this->setPermissions([ 'access CiviCRM', - 'generate JWT', + 'generate any authx credential', ]); $jwt = AuthxCredential::create()->setContactId($contactRecord['id'])->execute(); $validate = AuthxCredential::validate()->setToken($jwt[0]['token'])->execute(); @@ -70,7 +70,7 @@ class AuthxCredentialTest extends TestCase implements HeadlessInterface, Transac $this->createLoggedInUser(); $this->setPermissions([ 'access CiviCRM', - 'generate JWT', + 'generate any authx credential', ]); $jwt = AuthxCredential::create()->setContactId($contactRecord['id'])->setTtl(5)->execute(); sleep(10); -- 2.25.1