My use case is that I want to be disable domain_all on some nodes, but still basically use domain all's configuration.
I figure I'll just return a domain_access_some for the nodes I want viewable on all, but I'd rather not have to make a new configuration form etc, just git rid of domain_all from granting rights to all.
Figured an variable that modules could set would work, as a module would need likely never really need a ui to work.
(I guess I should explain how I do multiple node accesses: I have a module that does a node access records that calls all other node access records, throws out a drupal_alter, then returns all grants returned with highest priority. However unlike the records, so can't get rid of existing node grants).
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 744522-all.patch | 1.09 KB | agentrickard |
| #1 | domain_access_rule_override.patch | 763 bytes | hefox |
| domain_access_rule_override.patch | 492 bytes | hefox |
Comments
Comment #1
hefox commentedChanged to return regular grants when it's bypassed and got rid of what looks to be an extranious $op == view, as that is already checked earlier on as far as I can tell.
Comment #2
agentrickardI really don't understand this request. domain_all is a special case used on specific paths, not normally on individual nodes, and it is 'killed' by default.
Given that you are doing special handling already, you can do this in your own module using hook_domaingrants().
Comment #3
hefox commentedBasically I have some nodes I want restricted no matter what, ie if only if condition A is there a chance they can be seen; these are done via a different module. However, I do want special cases of domain all -- just need it to exclude condition A nodes unless condition A is met. So I still want to use the logic of domain_grant_all function, just not the domain_all.
When the domain grant all condition is met, domaingrants is not invoked...
Oh, so when I get home tonight I'll make a new patch that invokes domaingrants for domain all, or is there a reason that domaingrants isn't being invoked for all?
Comment #4
agentrickardOversight in the API. Never figures that anyone would want to cancel that out.
Comment #5
agentrickardTry this.
Comment #6
agentrickardThe problem is, this might not actually work for you. domain_all() really only affects listing queries, and you can't selectively make it active for some nodes in a list.
Still it may be an API improvement...
Comment #7
hefox commentedThat patch should work, I'll try it tonight.
I'll just remove the domain_all using the hook and should work fine with what I set up last night :)!
If you're curious about what exactly I'm doing:
How I set it up for domai_all is I add an additional per domain grant, domain_some with gid 0, view privileges.
In my alters, I combine the two modules grants together, ie in node access records foreach domain_id, domain_some, then foreach other module's grants I make a grant that combines the two (and remove the other grants), so grants for these special nodes have realm that are domain_id_othergrant and domain_some_othergrant (where non special nodes retain their domain grants along with a domain_some grant)..
So in user grants, if not on domain all I return domain_id_othergrant (if applicable), and on domain all I return domain_some and domain_some_othergrant (again, only when user has access) (and domain handles returning domain_id so all seems to be working fine).
So yeah, that patch should work fine :)!
Comment #8
agentrickardO dear lord that's complicated. :-)
So you don't use domain_all() for its original purpose...
Comment #9
hefox commentedPatch working as expected, thanks! Should RTBC? I doubt ... anyone else will review this patch other than to review it.
--
Anyhow, just sounds complicated! Basically I'm combing grants/node access records together to produce an AND instead of an OR for some nodes without having to modify core, domain_all was making it impossible though XD!.
I disagree in that I think I'm using domain_grant_all for mostly it's original purpose, but not using domain_all due unable to exclude special case nodes nodes.
If you're really curious, did a write up of what I am doing here : http://drupal.foxinbox.org/drupal/ramblings/how-node-access-handled-my-site
Comment #10
agentrickardCool. I'll commit this, since it doesn't break anything.