Hi,

Will this module be ported to Drupal 7? Or is there an alternative way of addressing this need in D7 with Domain Access?

Thanks!

Comments

espirates’s picture

+subscribe

Anticosti’s picture

Subscribing

andros’s picture

Subscribing

bowmo’s picture

subscribe!

artatac’s picture

Sub

torrance123’s picture

Status: Active » Needs review
StatusFileSize
new1.47 KB

I've rewritten domain_adv for Drupal 7. Rather than a rewrite hook, it was easier to disable domain access's hook_node_grants() method, and instead use Drupal 7's new hook_node_access(). With this hook, we can deny access if the node isn't accessible from the current domain, and if it is, simply let the request pass (as opposed to explicitly setting it to allow) — this means the rest of the node access system still runs, and organic groups (or whatever) can still deny access once hook_node_grants() is called.

I wonder whether domain should be using this method at its core?

silverwing’s picture

spam clean-up (excuse the noise)

bowmo’s picture

tried the 7.x version above in a test environment, 2 domains active in domain access.

put a couple of pages in with links in the main menu, which where only visible on domain 1. But they also showed up in the menu of domain 2. I did get an access denied, when trying to view the page.

Also a note from the api doc, that hook_node_access is not called everytime a node is loaded.. So that might be the reason to the outcome of my tests.

torrance123’s picture

Status: Needs review » Needs work

I wasn't aware of hook_node_access not being called on every request. From the docs:

In node listings, the process above is followed except that hook_node_access() is not called on each node for performance reasons and for proper functioning of the pager system. When adding a node listing to your module, be sure to use a dynamic query created by db_select() and add a tag of "node_access" to ensure that only nodes to which the user has access are retrieved.

So we still need a hook_alter_query *in addition* to hook_node_access to cater for this case. I'm not sure if that's the reason for your menu issue, though, but it's a possibility. I'll have a go at adding the rewrite rule later today.

Thanks for your feedback!

torrance123’s picture

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

Here's the module with an additional hook_query_alter() for removing forbidden nodes from lists of content. I'm still getting my head around the new QueryAlterable/QuerySelect/QueryCondition interfaces, but I think I've implemented this properly. I also spotted a misnamed variable from the code I posted earlier which I've fixed.

This is properly removing content from Views lists for me, and I'd be interested if it fixes the menu issue.

wellsys_world’s picture

Hi torrance123,

I'm using a combination of Domain Access, your Domain Access Advanced module and Content Access.

I have a content type set up using Content Access so that only users with a certain role can access the content type.

Although I have completely configured my two domains, it does seem to be working OK. I'll report back when I have completed my setup of the two sites and tested a bit more thoroughly.

Nice work!

Wellsy

wellsys_world’s picture

OK,

Did a bit more testing and it broke one of my Views. I got my site working again by ticking "Disable SQL rewriting" for my View and that got it working for me.

demma10’s picture

Subscribing.

demma10’s picture

Apologies for the double post. You can delete this one.

Encarte’s picture

Status: Needs review » Needs work

#13

stoptime’s picture

Thank you, thank you, and thank you again. Seems this still does the trick!

torrance123’s picture

Hi Stoptime (and others reading this thread),

I've since rewritten/adapted a different approach to solve this that works more consistently than the patch in this thread.

The repo for the module is available here (https://github.com/torrance/domain_og_bridge) and see the discussion thread here (http://drupal.org/node/1355272).

Please switch to using domain_og_bridge as it is maintained and works with both OG1.x and OG2.x versions.

adammalone’s picture

Thanks for a great bridging module - is there any chance this will be moved into drupal.org to become a project?

zeip’s picture

torrance123, does that work with other node access modules also? I have a site that's using Domain Access + ACL + Content Access, and for that domain_adv works nicely. With a quick look it seemed that your module handles the specific case of OG + DA, or?

torrance123’s picture

> torrance123, does that work with other node access modules also?

No, this module only handles the specific case of domain and OG I'm afraid.