Closed (outdated)
Project:
Domain
Version:
7.x-3.x-dev
Component:
Code
Priority:
Critical
Category:
Feature request
Assigned:
Reporter:
Created:
24 Aug 2011 at 12:25 UTC
Updated:
2 May 2025 at 12:36 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
David Stosik commentedHere is my first patch.
When user as no domain settings permission, instead of not putting any domain_settings form at all, the form is altered the same way, using the same submit callback, but with a hidden domain_id form item, which is set to a default value (what it would be if displayed).
This way, if an administrator decides that, by default, system settings forms apply to "current domain", then the user will save settings only to current domain.
Comment #2
David Stosik commentedFixed title
Comment #3
agentrickardThe theory is that anyone who has no access to domain settings is *always* working on the default domain.
So this would be a feature / change request and not a bug (nor a security issue).
I'd like to hear what others think about this, since no one has mentioned just this issue before.
Comment #4
David Stosik commentedWell, the theory is...
But in practice, it happens that I can be a user with "administer site configuration" permission, but without "access domain settings form".
This way, the system settings forms I submit will affect all domains, including default domain, even if I'm currently working on another domain.
That's really not the expected behavior (in my point of view, which may be biased), and at least, if it's not a bug, it should be a usability issue...
Comment #5
agentrickardDoes that user at least get the proper warning about the form?
Comment #6
agentrickardI'm not suggesting this isn't desired behavior. But it is a pretty major *change* in behavior, so one request and patch isn't enough to change it.
Comment #7
pounardI think this cause serious data consistency problems. Some user modifies the configuration while browsing on a specific domain but the system changes the global site configuration instead: this doesn't make any sense.
Because a user cannot access a specific domain (let's say level 1 configuration), he can break without remorse the hosting site configuration (let's call it level 0): it's all backwards!
It sounds like "User A cannot remove content 1 on site A, but he can remove ALL content on site B that shares content with site A, the conclusion is he finally can remove the content 1", it is a real problem IMHO.
If the user cannot access the domain configuration, but he is actually browsing on the domain, it should never changes the hosting plateform configuration: he should, in the worst case scenario, have an empty form or an error message to warn him.
Comment #8
David Stosik commentedagentrickard : no warning at all, as Domain Settings just falls back to default behaviour if user has not access to domain settings form...
Comment #9
agentrickardRight, the assumption has always been that you would never configure your site permissions in this way.
That is, anyone who can 'configure site information' is a super-user and should have domain permissions as well. Alternately, Domain Settings is not appropriate for your site.
I see three options:
1) Reject the change
2) Implement the change as a configuration option, so that the new behavior may be enabled, but is not on by default.
3) Implement the change so this behavior happens by default, but add some messaging in the UI that makes clear what is happening.
With Domain Conf, we issue a warning about domain-sensitive forms. That warning, however, is removed by Domain Settings (so maybe we should only do that if the user has proper permission).
Comment #10
David Stosik commentedI should add that my patch does not force to save settings only to current domain if user can't see "domain settings form". Instead, it uses the "Default form value when submitting system settings" set in admin/structure/domain/settings.
This, maybe, could be considered as a bug ? When the form is not displayed, should Domain Settings save settings to all domains (which is actually the case), or should it use this "Default form value when submitting system settings" (which I suggest with my patch) ?
Comment #11
agentrickardBumping versions. In 7.x.3, we can simply commit this as a change.
Comment #12
David Stosik commented3.x port.
Comment #13
agentrickardHow does this compare to #809128: Restrict settings form to users with domain access? Does it work when both are applied?
Comment #14
David Stosik commentedIndeed, the problems this other issue raises are interesting. I ported the associated patch 3.x then improved it a bit (see #809128: Restrict settings form to users with domain access).
I'm affraid both patches couldn't be applied one over the other, that's why I wrote a final patch, including modified patch in #12 and last patch in #809128: Restrict settings form to users with domain access (comment #9).
This "ultimate patch" is attached, and here is a summary of its effects :
* DS form is Domain Settings form, abbreviated.
This prevents many flaws, such as saving settings to a domain I don't have access to, or saving to all domains while not having the permission. This also prevents from bypassing domain_settings module when having permission to access system settings form, but not the permission to "access domain settings form".
Regards,
David
Comment #15
agentrickardPatch the checks the code logic, fixes a weight error, and correct some style issues.
Updated the @fixme in the previous patch to stop the alter if the user has no access to $default. Odd but probably proper.
Comment #16
David Stosik commentedI don't agree on this
First because a user who has "administer domains" may not have current domain in its domains.
Next, I think that domain_settings should never disappear and let the form unaltered (which would mean letting the user save to all domains, without any check).
There are, indeed, ways to display a DS form where no suitable default is available. For example, when domain login is not restricted, users may possibly login on a domain they've not been assigned. But in such a case, is it normal, and secure, to let them save administration settings to all domains ? I think not.
Instead, I think that the user should be displayed the DS form, without any default selected. This way, he will have to confirm his choice by explicitly choosing a domain.
If user can't display the form (no "access domain settings form" permission) though, something must be done.
But failing to manage by-domain settings is not an acceptable solution. So what's about it ?
The last fall-back situation :
What kind of solution :
None of these sound extremely good to me, but those solutions sound better than "do nothing and save globally" option to my ears. My preference goes in this order : 3, 1, 2.
Regards,
David
Comment #17
agentrickardPoints:
-- The user with 'administer domains' gets $user_domains set to all domains earlier in the code. If that isn't set properly via array_keys(), then that code needs to be changed.
-- It would not save to all domains, just the primary domain (default behavior of the form, which is the current behavior without this patch).
-- We have a bigger problem with certain admin forms that are never affected by Domain Settings, since they don't use system_settings_form() at all (e.g. Date and Timezone handling). These will just lead to mass confusion.
I'm still very iffy on this patch. Domain Settings is a module for power users. If it causes problems for other classes of user, people simply shouldn't use it.
Of the options above, I think #3 is best.
And I'd still like to see some sort of warning message to the user.
Comment #18
David Stosik commentedAnswering to your points :
- That's true, I forgot about that. ^^'
- Well, saving to "primary domain" also means saving to all domains that have no specific setting yet.
- That's true, but is there anything doable for these ? I guess not...
Attached patch adds following improvements to previous patch :
- as a last fall-back, default to current domain, only if DS form is hidden (if DS form is displayed, it can have no default value, forcing user to chose one)
- when DS form is hidden, display a warning message telling the user wich domain the settings will be saved to.
Regards,
David
Comment #19
agentrickardExcellent.
I'd still like to get some other opinions here.
Comment #20
David Stosik commentedNo opinions on this one ?
Patch still applies on last dev version. ;)
Comment #21
twistor commentedI just ran into this today. My thought was that after turning off Domain Settings access to a user, the settings form would default to the current domain.
On a related note, it would also make sense if the DS form defaulted to the current domain, rather than the default. I have been bitten by this twice today already.
Patch test coming in a bit.
Comment #22
David Stosik commentedIt's possible to default to the current domain if the form is displayed. There's a setting for this in Domain Access. ;)
And my patch allow to follow that default setting, even if form is not displayed.
Comment #23
labor b commented+1 for David's solution
The form displays the settings of the current domain, but stores them for the primary domain. I consider myself a power user and it still confused me. Actually I didn't ever think about storing to the primary domain from some other domain without explicitly selecting this and no warning whatsoever.
Comment #24
bluegeek9 commentedDrupal 7 in End of Life and no longer supported. We encourage you to upgrade to a supported version of Drupal. For more information, see https://www.drupal.org/upgrade.