Latest patches are for the 7.x-3.x branch
Not sure if this could find it's way into the 6.x-2.x branch or will have to wait for D7 but here goes:
The assign domain editors permission allows users to assign domain editors to any domain, even if they are not a member of that domain.
I think it would be useful to add a permission that allows users to assign domain editors only to domains they are a member of.
I have a patch that adds a new permission for this case. It honors user default domains even if the assigning user doesn't have access to those domains. Seems to me to work.
It is against 6.x-2.1 due to there not being a 6.x-2.x-dev branch at the moment.
Comments
Comment #1
agileware commentedSorry, I found a little bug in that patch. Here is a new one.
Comment #2
agileware commentedSorry, I think my brain is having a meltdown today.
Here it is again with another bug fix.
Comment #3
agentrickardThis could go in D7 as a patch against HEAD. For D6, do you think it could work as a stand-alone module?
Comment #4
agileware commentedIf I make the stand alone modules weight so it runs after domain it probably could be done like that.
I can have a look into it shortly when I get a free moment.
It would be a very tiny module though.
Comment #5
agentrickardYou can hook_form_alter() the user form, which is generated after hook-user() runs.
Tiny is fine. If we don't lock the 6.x features, I can never start on the D7 port.
Comment #6
agileware commentedYeah no worries.
When I get a bit of free time I'll re-roll this patch for HEAD and turn this one into an add on module for D6.
Comment #7
agentrickardYou might be able to add it to the Domain Bonus Pack module set.
Comment #8
agentrickardHm. You can't really write it against D7 yet, because HEAD has not been ported. So a patch against DRUPAL-6--2 branch might be more appropriate. Otherwise, this would have to wait.
Comment #9
agileware commentedOK, I'll submit it to the domain bonus issue queue and reroll this for DRUPAL-6--2
Comment #11
agentrickardRevisit later.
Comment #12
agentrickardComment #13
duaelfrI needed it so I did it :)
This patch is part of the #1day1patch initiative.
Comment #14
agentrickardNice. Could use a test, of course.
Comment #15
mvwensen commentedThe #13 was not secure. An editor removes domains from a user he is not assigned to + by editting the post data the editor can assign domains to people he has not been assigned to (Security thread).
Modified the patch:
- For the global user, get user domains instead of assuming they are on the user object (in some cases they are not set).
- Added validation checking if an editor submitted domain ids that are matching the one's he is assigned to (prevents fraudulent data)
- Adding the domain ids for the domains that are not assigned to the editor but the user was already assigned to.
Tested on todays dev-branch and the latest stable.
We will add the patch to drupal.org/project/dvg, so it will be great if somebody could review it.
Comment #16
mvwensen commentedComment #17
ruudvanoijen commentedTested and reviewed this patch. Works as described.
Comment #18
mvwensen commentedWould be great if someone else reviews it too and it would be better if it ends up in the module ;)
Comment #19
askibinski commentedAlso reviewed this patch. Looks good and works great.
Comment #20
askibinski commentedFound an edge case which needs work:
users like root or adminsitrators who have the "Administer domain records and settings" permission should be able to set domain access for their own account or other account.
Comment #21
mvwensen commentedNice catch!
Added a check on the validation for uid 1 and the "assign domain editors" (all domains) is on. "Administer domain records and settings" is not really a permission to give to supereditors etc.
Patch attached.
Comment #22
mvwensen commentedComment #23
askibinski commentedBetter, looks good to me, tested this with various user, roles and permissions and works as expected.
Comment #24
agentrickardApologies for the late review.
I think there is a case that this doesn't account for, in which an editor of domain B edits a user assigned to domains A, B, and C.
In that case, the editor should be able to remove the access to B, but not to A and C.
See the very ugly $form['domains_raw'] handling code in domain_form_alter(), which is how we account for that case with nodes.
Note that I just added this feature to the Drupal 8 version.
Comment #25
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.