Hello,
I am rather desperate to use OG user roles with Views such that I limit access to views and particular views fields based on OG user roles. It doesn't work. Is that expected? Or is there something wrong with my setup? I've tried over the course of several versions of the OG user roles and OG and Views, so I'm filing this as a bug report as it seems to always consistently not work.

Thank you!

Comments

i.chris.jacob’s picture

Hi Sammos,

I have a similar issue. But this is not a bug. This is how the modules is intended to work. To my understanding OGUR assigns roles which are only upheld while the user is within what I call 'group-scope' (e.g. og/something pages). Outside of this scope the Group Roles don't apply, Sitewide Roles are what apply. This may help: http://drupal.org/node/343354 (but it's a bit cryptic)

Try reading my recent Feature Request...
Assign 1 or more Sitewide Roles upon joining a particular group.
http://drupal.org/node/441346

Hope that helps

somebodysysop’s picture

Status: Active » Closed (works as designed)

Yes, this is correct. OGUR only works in group context. So, in order for a user's group role permissions to have effect within a view, the view must be in group context.

lelizondo’s picture

Version: 6.x-1.x-dev » 6.x-4.x-dev
Category: bug » support
Status: Closed (works as designed) » Active

I am probably going to say something really stupid.

1. The context of a view is determined with the argument, if I use groups/%/stories as the view path the argument will pass and views will filter the stories for the current group. The inconvenient with this is that you can't use tabs menus, you have to go to node/%/stories (different story).

I know the context is preserved since running:

$group_node = og_set_group_context();
$gid = $group_node->nid;

gets the correct Group ID.

2. I've been reading thought the code of 6.x-4.x version of this module (here comes the stupid comment) and I think the problem is with OGUR since is not checking somehow the context properly when we're on a view and is not assigning the roles because it lacks of a context. I think the problem is with og_user_roles_determine_context() since it checks for the context on only nodes, comments, and the frontpage and not when it finds the argument.

Also, changing the path to something like og/%/something didn't work for me.

Am I right, or I just said something really stupid and there's no workaround for this?

lelizondo’s picture

It wasn't that stupid at all. OG and OGUR didn't have a context when on a view. I applied the patch here http://drupal.org/user/440632 and is working great. I had to do it manually and apply it both to OG and OGUR. Is not that hard.

sun’s picture

Version: 6.x-4.x-dev » 6.x-1.x-dev
Status: Active » Closed (works as designed)

This may apply to 1.x, but definitely not to 4.x.

And since SomebodySysop already marked it as by design, I'm reverting the status.

lelizondo’s picture

it does apply for 1.x and 4.x, works with both, I can confirm that.

The only problem is that version 4.x does not include the 'clear cache' option to flush the permissions and I'm having the access denied problem when trying to add a node.. so I downgrade to 1.x again.. I've been reading about this problem but I can't find the cause, is it another 'og family' module? which one?