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).

Comments

hefox’s picture

StatusFileSize
new763 bytes

Changed 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.

agentrickard’s picture

I 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().

hefox’s picture

Basically 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?

agentrickard’s picture

Status: Needs review » Needs work

Oversight in the API. Never figures that anyone would want to cancel that out.

agentrickard’s picture

Status: Needs work » Needs review
StatusFileSize
new1.09 KB

Try this.

agentrickard’s picture

The 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...

hefox’s picture

That 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 :)!

agentrickard’s picture

O dear lord that's complicated. :-)

So you don't use domain_all() for its original purpose...

hefox’s picture

Patch 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

agentrickard’s picture

Status: Needs review » Fixed

Cool. I'll commit this, since it doesn't break anything.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.