Needs work
Project:
OG User Roles
Version:
6.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 May 2009 at 03:32 UTC
Updated:
7 Aug 2011 at 01:52 UTC
I came across a situation where OGUR wasn't behaving as I thought it should. this was because user_access() was caching the perms of the user before OGUR had the change to add the roles in.
so when roles are assigned to a user, the user_access cache needs to be flushed.
| Comment | File | Size | Author |
|---|---|---|---|
| flush-perms.patch | 1.02 KB | josh waihi |
Comments
Comment #1
somebodysysop commentedSubmitted code change to dev release. Should be available in about 12 hours. Please report back if it works. Thanks for the post and patch.
Comment #2
josh waihi commentedI have applied this patch and it worked for me.
Comment #3
scs_calleros commentedThis patch solved problem of Access denied in "Configure member roles" tab
More info:
http://drupal.org/node/672302
Thank you.
Comment #4
spacereactor commenteddoesn't seem to work for me
Comment #5
jvieille commentedI seem to have this issue. I cannot create any node with roles assigned through OGUR.
The code as much changed since this patch was suggested. The current function looks like this:
function og_user_roles_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'load':
// In case the global user object is reloaded from scratch, re-assign
// our additional roles.
if ($account->uid == $GLOBALS['user']->uid) {
og_user_roles_grant_roles($account);
}
break;
the function og_user_roles_list_users_sql does not exist anymore
Comment #6
Dave Cohen commentedAn updated patch is something like this. But, it does not work for me. It seems my hook_access is being called and sometimes the user's roles are correct (OGUR roles set) and sometimes not.
(sorry for the patch format, didn't cut and paste properly, and I'm working remotely so its a hassle to get the patch file)
Comment #7
Dave Cohen commentedtrying to track this down, I noticed that my hook_access is called from a long and convoluted stack trace. It seems during some module's hook_init somehow i18n_selection_mode() gets called, which calls menu_get_object() which eventually leads to the hook_access call. So maybe this issue only happens when i18n modules are enabled?
Comment #8
Dave Cohen commentedThere is an unpleasant chicken and egg problem here. In that og expects a node (and not an nid) for its context. Meanwhile, loading that node causes some modules to call into the menu system, causing it to check access to the current menu item (before the og context is set).
So as a hacky workaround, I grant the og_user_roles before setting og context. This is in my hook_init(), where I already have some code to learn the og $nid...
Comment #9
fuzzy76 commentedCan we get any feedback from the maintainers on this? I am hitting a similar problem.
Comment #10
hefox commentedI believe the 4.x version of this module handles this