Skip to content

Commit

Permalink
block Sync CMS Users form and functionality on Standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin committed Feb 9, 2024
1 parent 06df990 commit ef3c3dd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
10 changes: 10 additions & 0 deletions CRM/Admin/Form/CMSUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ class CRM_Admin_Form_CMSUser extends CRM_Core_Form {
*/
public $submitOnce = TRUE;

/**
* Disable on Standalone
*/
public function preProcess() {
$config = CRM_Core_Config::singleton();
if ($config->userFramework === 'Standalone') {
throw new \Exception('No CMS to sync users to when using CiviCRM Standalone');
}
}

/**
* Build the form object.
*/
Expand Down
5 changes: 3 additions & 2 deletions CRM/Utils/System/Standalone.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,11 @@ public function getUserIDFromUserObject($user) {
}

/**
* @inheritDoc
* Disabled on Standalone
*/
public function synchronizeUsers() {
return Security::singleton()->synchronizeUsers();
throw new Exception('No CMS to sync users to when using CiviCRM Standalone');
return [];
}

/**
Expand Down
14 changes: 0 additions & 14 deletions ext/standaloneusers/Civi/Standalone/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,20 +279,6 @@ public function getCMSPermissionsUrlParams() {
return ['ufAccessURL' => '/civicrm/admin/roles'];
}

/**
* Since our User entity contains a FK to a contact, it's not possible for a User to exist without a contact.
*
* @todo review this (what if contact is deleted?)
*/
public function synchronizeUsers() {

$userCount = \Civi\Api4\User::get(FALSE)->selectRowCount()->execute()->countMatched();
return [
'contactCount' => $userCount,
'contactMatching' => $userCount,
'contactCreated' => 0,
];
}

/**
* High level function to encrypt password using the site-default mechanism.
Expand Down

0 comments on commit ef3c3dd

Please sign in to comment.