A user that is assigned to a domain and allowed to edit content on this domain is not able to edit the domain source setting if it is set to "Use active domain".
While creating content the user is able to choose the source domain ("use active domain" or assigned domain).
If the user chooses the assigned domain for source domain, then the user is able to edit source domain if the user edits the content again after creating.
If the user initially chooses "use active domain", then the user is later not able to change the source domain again.
I suppose this is not intended behavior, so maybe it can be considered as a bug.
There is some filtering done to only show the source domain select field if the user is assigned to the source domain. This is surely valid and functional, but it does not consider the case where the source domain is set to "use active domain".
Provide small patch that makes the select field available if the content has "use active domain" as source domain.
Comments
Comment #2
stefan.kornComment #3
stefan.kornComment #4
stefan.kornComment #5
agentrickardYes, I think this is an oversight in the code. It might be more clear to fix this a little higher up.
I think there may also be a contradiction here, as the comment in line 54 might also apply to the 'Use active domain' option.
But then on line 71, we reintroduce the option without comment.
I think the original intent was that only users with a higher permission level would be able to set the value to 'Use active domain.'
Thoughts?
Comment #6
agentrickardHere's the alternative patch, which I think is logically correct. Again, I'm open to debate on this.
Comment #7
stefan.kornYes, I understand your point on this.
In my own use case this would incur some problems because the users loose the option to set active domain and this was the default option all the while and the workflow depends on this option in some ways now.
But I can understand the intention about giving this only to high level users.
I am not sure about the permission "set domain access" but seems to me it does include some more power. Would it maybe make sense to introduce a new permission like "use active domain setting" to have something between giving all the power and just that little thing about the source option?
Comment #8
agentrickardI hate to add a new permission this late in the D7 cycle.
Given that the current code makes this option available but then hides the form element, then I think the patch in #5 is correct.
https://www.drupal.org/files/issues/2919272-domain-source-form-4.patch
Comment #9
agentrickardLooking at more code. Domain Source has no current permissions, so it's not clear how disruptive it would be to add one.
Comment #10
stefan.kornBe aware that you never get to the new code in https://www.drupal.org/files/issues/2919272-domain-source-form-4.patch when the source is "use active domain" because this
does not let you get there as this will not be true if source is "active domain" (-5)
isset($account->domain_user[$source])
Comment #11
agentrickardGood catch.
Comment #12
agentrickardHow about this one, which does add a permission.
Comment #13
stefan.kornYes, that looks very good to me.
But I don't want you to to anything you don't like. I would also respect your remark about not wanting to introduce a new permission now -> you're the maintainer :-)
But if you get the patch from #12 in that would be great.
Comment #14
agentrickardI don't think this has a huge impact. It doesn't change the current behavior unless people activate the new permission. I'm also not sure when I'll roll another stable release.
Comment #15
agentrickardIt would be ideal to have tests for this behavior. Right now, we don't do any tests on this specific behavior.
See testDomainSourceForm.
Actually having tests would have caught this issue.
I'm about to go on vacation for 10 days...