-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev/core#4993 block Sync CMS Users form and functionality on Standalone #29351
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
The issue associated with the Pull Request can be viewed at https://lab.civicrm.org/dev/core/-/issues/4993 |
ef3c3dd
to
662ec86
Compare
$config = CRM_Core_Config::singleton(); | ||
if ($config->userFramework === 'Standalone') { | ||
throw new \Exception('No CMS to sync users to when using CiviCRM Standalone'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is a draft but just noting two things:
- A year or two ago we tried to remove most of the
if Drupal
from various files to make it more OO-ey. I know in standalone sometimes it hasn't booted yet and so there's no choice, but here I think it would be better to do something likeif !$config->userSystem->allowsUserSync()
and then CRM_Utils_System_Base::allowsUserSync would return true, and CRM_Utils_System_Standalone::allowsUserSync() would return false. In theory this also allows mocking both variations in backend unit tests (although it's not currently set up for more than one unittest mock). - In forms we usually use CRM_Core_Error::statusBounce instead of throwing exceptions. Even if it were to throw an exception it's preferred to use CRM_Core_Exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for these pointers 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This got me thinking -- it's specifically standaloneusers that the syncing is incompatible with. So I've made it conditional on that, leaving open the door for alternatives where syncing is a thing (external auth providers maybe?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ufundo 🤯 I think external auth providers might be dealt with in a way other than replacing the whole of standaloneusers. But ok!
dab1344
to
7da08f0
Compare
7da08f0
to
6e8e15f
Compare
6e8e15f
to
7d8c738
Compare
Tested, this does hide the menu item and prevent access to the page. Merging, thanks @ufundo |
Overview
Block CMS user sync form when using Standaloneusers extension, because it doesn't do anything. And the most secure code is no code.
There was a note about the case when the contact of a user was deleted -- but deleting a contact with a user attached is prevented with #29026