Drupal 10, the latest version of the open-source digital experience platform with even more features, is here.If you log into devshop as an authenticated user, when you have all the right "create site permissions", you get a big ugly error message on the site create form:
Your user is not associated with any clients so you are not allowed to create new sites
Turns out this isn't actually true. Submit the form, it works normally.
The form_set_error() was called from inside a function that's being used to return the #default_value of the client field! No validation is happening at all.
Turns out the code for client field is in hosting_site, it should be in hosting_client.
I don't know who actually uses this feature, since it's actually broken, but this patch preserves the assumed functionality, and adds a new setting to the clients page:
Require users to have a client to create a site.
If this setting is on, users will not be able to create sites unless they are associated with a client.
It defaults this setting to "Off", but runs an update hook to preserve existing aegir sites behavior.
Let me know if you think this is even a feature we should have, considering it never actually prevented users from submitting sites in the first place.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3018114-client-optional.patch | 4.62 KB | Jon Pugh |











Comments
Comment #2
Jon PughWait, this doesn't actually seem to prevent the users from submitting a site at all.
:|
The warning message is pretty loud, though and I want to get rid of it without granting access to "administer clients" permissions.
Comment #4
Jon PughYeah I see what's happening now.
That warning "Your user is not associated with any clients so you are not allowed to create new sites"
is triggered from a call from the #default_value field! So it doesn't fire at all on submit.
I had no choice, I had to refactor this, despite the fact that I've never used Clients before. This is the first step in making clients NOT required.
Comment #5
Jon PughDefinitely a bug. It tells the user "You can't create a site" but they certainly can!
Marking major as it doesn't respect access control.
Comment #6
Jon PughComment #7
Jon Pughhelmo colan ergonlogic?
Comment #8
Jon PughRTBC by DevShop
Comment #9
Jon Pugh