Hello!
Due to the recently committed issue #2838149: Respect Registration Account Setting, now the module will refuse to create users if the site is set to "only administrators can create accounts". Which is ok in most cases, but not in our current one :)
In our case, we want to allow automatic registrations to the site only for people logging via openId (via our google app domain), but only though that. So, the site was set to "only administrators can create accounts", and we were registering users via openid. Now with the beta3 version this is not possible anymore.
So, in order to support our use case (which sounds like it might be useful for other people) we propose to add a new setting in the settings page, that will allow admins to "override" the registration settings. This setting would be initially set to false. If true, the check is skipped and the user is created.
What do you think?
Attaching the patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | allow_to_override_2904411_9.patch | 6.21 KB | sanduhrs |
| #9 | allow_to_override_2904411_9.interdiff.patch | 5.08 KB | sanduhrs |
| #5 | allow_to_override_2904411_5.patch | 6.07 KB | vermario |
| #2 | allow_to_override_2904411_1.patch | 4.6 KB | vermario |
Comments
Comment #2
vermario commentedPatch attached.
Comment #3
interx commentedThanks for the patch, I'm in a similar case: don't allow any manual user registration, but do allow OpenID Connect users.
The patch works fine. I do have some remarks:
Comment #4
yannickoo@interX you can find a patch for this feature over in #2867260: Add pre_login hook similar to post_authorize hook (D8 version) :)
Comment #5
vermario commented(hi @yannickoo!) :) It seems to me that the linked issue provides a code based solution (which is nice), while this patch provides a solution via the ui/config. For this reason I think it might still be useful, and I am providing a revised patch following the feedback from @interX (thank you very much for the feedback by the way!)
Comment #6
interx commentedI think this patch is a more elegant way to simply override the registration setting and continue the path in the OpenID Connect module.
A pre_login hook could be useful, but imo it shouldn't be used as in the linked example (specifically create an authmap for the account manually).
Comment #7
yannickooSorry for the confusion, the patch over in the other issue is handy if you e.g. migrate users beforehand but in your case you want to allow registrations via OpenID Connect but not via
/user/register– sorry 😬Comment #8
interx commented/nitpickmodus on :)
Normally the comment:
should continue on one line until a word reaches the 80 characters limit, and then go to the next line.
Also, Drupal should always start with a capital. So, it should be:
/nitpickmodus off
Comment #9
sanduhrs* Changed the code to only respect override in case admin only is set for user registration.
* Changed order of form elements
* Some code style fixes
* Syntax error fix
Thanks for the patch!
Comment #11
sanduhrsComment #13
rojan raj commentedWhat if user settings has Visitors, but administrator approval is required.
Currently I have this requirement.
Comment #14
rojan raj commentedWhat if user settings has Visitors, but administrator approval is required.
Currently I have this requirement.