After installing Domain View, I would like to Restrict View access by domain. No role has the "access all views" permission. In the view's access settings I check a single domain XXX. Access to the view is now denied from any domain, including XXX. The view's menu items do not show up, and the following error is issued:warning: Invalid argument supplied for foreach() in /var/www/drupal/sites/all/modules/domain/domain_views/domain_views.module on line 75.
Also, I am not sure I understand the first part of the help string:Only users with the selected permission flag will be able to access this display. Note that users with "access all views" can see any view, regardless of other permissions.
isn't the permission flag associated with domains, rather than users?

Comments

nonsie’s picture

Access to the view is now denied from any domain
Please specify which permissions the user/role attempting to view this view on domain XXX has? From the message you got it seems they don't have access to the domain.

Only users with the selected permission flag will be able to access this display. Note that users with "access all views" can see any view, regardless of other permissions.

This means that the view is only available on the specified domain and only to users that have access to that domain. Look into domain_node_grants() in domain.module for the basic background info. This is later altered by other modules implementing hook_domaingrants() (such as Domain Strict).

The attached patch (against HEAD) should get rid of your error message.

nonsie’s picture

Status: Active » Postponed (maintainer needs more info)
skizzo’s picture

Version: 6.x-2.0-rc8 » 6.x-2.x-dev

I had no restrictions, neither by-role nor by-domain, and users could see all views in all domains. The problem was exposed when I tried to enforce a restriction by-domain. The provided patch does fix the problem. Thank you, also for the clarification: it wasn't clear to me because in my context I have no restrictions by-user, and no Domain Strict.

agentrickard’s picture

Status: Postponed (maintainer needs more info) » Needs work

The patch would need to check:

if (!empty($grants['domain_id'])) {

Otherwise, you could still generate the error.

agentrickard’s picture

Status: Needs work » Needs review
StatusFileSize
new5.63 KB

OK, I went a little nutty with this patch, sitting in an apartment in Paris. There are two access schemes we might care about:

1) The Domain Strict model, which asks, 'Can this user see content on this domain.'
2) The Domain Editor model, which asks, 'Is this user a member of this domain.'

The attached patch supports both.

agentrickard’s picture

Status: Needs review » Fixed
StatusFileSize
new5.25 KB

Updated and committed.

agentrickard’s picture

Status: Fixed » Active

This broke something in the access check.

agentrickard’s picture

Status: Active » Fixed
StatusFileSize
new3.83 KB

Better patch. Committed.

Status: Fixed » Closed (fixed)

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