Domain override default permissions

kenorb - September 10, 2009 - 11:51
Project:Domain Access
Version:6.x-2.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I've got node 181 in node_access as follow:

181, 0, 'domain_id', 1, 1, 1
181, 0, 'domain_site', 1, 0, 0
181, 5, 'view_own_role', 1, 0, 0
181, 82, 'view_own_owner', 1, 0, 0

It shouldn't be visible for all users, but it's.

#1

kenorb - September 10, 2009 - 11:52

#2

agentrickard - September 10, 2009 - 13:34
Category:bug report» support request

Yes, it should. The second row means: "Show this node on all affiliate sites."

Use Devel Node Access module, and it will explain what these rows mean.

Using multiple node access modules (which you are apparently doing) uses an OR based permission system. So if either system grants access, the user gets access. You may need a custom integration module to make the two modules work together. You can use hook_domaingrants() and hook_domainrecords() to modify how DA behaves when the other module is present.

#3

kenorb - September 10, 2009 - 15:06
Title:Problem with permissions» Domain override default permissions
Category:support request» feature request

Why it can't set default permission that are already set?
Like View Own module doing that in _get_default_permissions() ?

function _get_default_permissions() {
  $result = db_query("SELECT r.rid, p.perm FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid");
  $perms = array();
  while ($row = db_fetch_object($result)) {
    $perms[$row->rid] = explode(', ', $row->perm);
  }
  return $perms;
}

Why I should use hook_domaingrants and hook_domainrecords if I need my default permission which I already set?

#4

agentrickard - September 10, 2009 - 16:04
Category:feature request» support request

What?

I don't even understand your question. The two permission systems are entirely different and _stepping on each other_ because Node Access applies OR logic to the grants.

You would use hook_domaingrants() to _remove_ the 'domain_site' grant and possbly the 'domain_id' grant so that View Own can have the only say in content access.

#5

kenorb - September 10, 2009 - 16:10

Thanks, I'll try to remove this domain_site grant.

#6

kenorb - September 14, 2009 - 13:16

I can't find the format of hook_domaingrants().
Nothing in documentation, README and no examples.
Any help?

#7

agentrickard - September 14, 2009 - 13:48

Look again. API.php.

 
 

Drupal is a registered trademark of Dries Buytaert.