using OG 6.x-2.x-dev (2010-Mar-24) & OG User Roles (2010-Mar-11)
I have 4 roles // - anonymous user // - authenticated user // - Group owner // - Helper
And 1 "Group News" content type for group post. Group owner roles is for group admin and group admin assign members from the authenticated list from their memberlist to promote trusted user to become "Helper" role. The Helper user can than create and maintain "Group News" content type within their group. I did get the "create group news" link as Helper role but when when click is Access denied - You are not authorized to access this page.
If i manually add the user to HELPER roles as drupal admin, than he/she can create "Group News" but he or she can also create group news in all the groups they have join in which is not what i want. Which step did i miss out in order for group admin to control the helper role to create "Group News"?
| Comment | File | Size | Author |
|---|---|---|---|
| #34 | og_user_roles-hook_og_group_context_set-770870-34.patch | 505 bytes | fuzzy76 |
| #33 | og_user_roles-hook_og_group_context_set-770870-33.patch | 502 bytes | fuzzy76 |
| #32 | og_user_roles-access_denied-770870-32.patch | 785 bytes | fuzzy76 |
| #29 | use_proposed_hook_og_group_context_set-770870-29.patch | 832 bytes | juanjo_vlc |
| #19 | og_user_roles.module.patch | 772 bytes | wdouglascampbell |
Comments
Comment #1
spouilly commentedHi there,
I am having the same issue ... using a minimal install of Drupal (6.16) + OG (6.x-2.1) + OGUR (6.x-4.1).
But
Any help would be welcome ... The strange thing: I am using the devel module to display node access rights, but I don't get anything on the "Access denied" page.
Final remark: my site is not located at the root of the webserver (i.e. pages are served from http://localhost/project_name and not http://localhost). It seems there was an issue with that configuration for OGUR version 1.X (1.5, 1.6) ... is it still an issue with version 4.1?
update 1:
update 2:
final update:
Cheers,
Sylvain
Comment #2
spacereactor commentedIt doesn't seem to work, i already using "Group Detail" block and OG User Roles that have permission to create to node type and given the role thru OG is still getting "Access denied - You are not authorized to access this page." The link exist example have http://localhost/project/node/add/story?gids[]=8 but the OG User Roles doesn't work when create node.
Comment #3
projectnashville commentedI can confirm the behavior and work around from comment #1. Will the navigation menu be supported, or will the details block / custom menu need to be utilized?
Comment #4
spacereactor commentedFollow #1 and under post setting -> rebuild permission and now OG user role is working, but i still getting "Access denied You are not authorized to access this page." when user try to translate their own node, i already set the user role permission to translate. They can only translate when i change that role from OG group to sitewide access. Can anyone confirm that OG User role doesn't support translate module. Thank.
Update.
it work if manually http://localhost/project/node/add/CONTENT_TYPE?gids[]=X&translation=Y&la...
X is your ID of the group
Y is node ID for translation
Z is language Code
Sorry i can't help with the programming side, hope someone can look into this and come out with a patch.
Comment #5
spacereactor commentedComment #6
spacereactor commentedMy localhost is able to create new node with group detail menu but my hosting server can't. Keep showing "Access denied - You are not authorized to access this page" even with group detail menu or even manually http://mdomainname.com/node/add/groupnews?gids[]=14
I found out that OG User Roles is incompatible with i18n, once there i18n is install, OG User Roles not working when creating new node "Access denied - You are not authorized to access this page"
Need Help with this one.
Comment #7
wdouglascampbell commentedI am seeing the same issue with "Access denied - You are not authorized to access this page". I also am running i18n on my site. Appreciate any help in resolving.
Comment #8
wdouglascampbell commentedI found a partial solution to some of the issues.
In the function og_user_roles_menu_get_item(), there is a note that states "OGUR: Allow privilege escalation; always load map.". The person who put this note commented out the check to see whether access was allowed to the menu router_item. In looking through the rest of the Drupal code though, it needs the access element to be true to allow access to an item. So after the lines:
I added the following:
This allowed a user who only had group content posting privileges to create a page node using the following type of page creation link:
http://[path to drupal site]/?q=en/add/node/page&gids[]=244Now, if later this same user wants to translate the node, there is a problem. The URL that the translation add page link provides is like the following:
http://[path to drupal site]/?q=en/node/add/page&translation=262&language=zh-hansThis now brings up a blank page. I think this maybe an oversight (bug?) in Drupal core in the node_add() function. Somehow this should either give us a page not found error or access denied.
Any way, if we change the above link to:
http://[path to drupal site]/?q=en/node/add/page&translation=262&language=zh-hans&gids[]=244Then the create page form appears as desired.
It seems like, if these changes I have shown above are the right ones, we still need to consider how to handle the following cases:
Adding a page using the main navigation create page link:
http://[path to drupal site]/?q=en/add/node/pageAdding a translation to a page:
http://[path to drupal site]/?q=en/node/add/page&translation=262&language=zh-hansComment #9
wdouglascampbell commentedOpps. I just noticed that I am using the 6.x-4.1 version not the 6.x-4.x-dev version that this issue was reported with. I will need to check the dev version out and see if that removes the need for my changes as it appears it does as I re-read the comments about more closely.
Comment #10
spacereactor commentedi add #8 and i feting this error when i install OG User Roles
Fatal error: Unsupported operand types in /home/mycellgr/public_html/includes/common.inc on line 1592
Comment #11
wdouglascampbell commentedI have now tested with 6.x-4.x-dev and the problem remains. My two line hack does continue to partially resolve the issue for me but I would like to find something more robust.
@spacereactor - not sure why you would get that error as a result of adding those lines. maybe you have a typo.
Comment #12
wdouglascampbell commentedLet me add that I have verified that if I disable the i18n module, these problems go away just like @spacereactor stated in #6.
Comment #13
wdouglascampbell commentedOkay. Scratch the above changed in comment #8. It was causing other issues, such as a regular node/add/page giving a page not found error and I decided to delve in deeper into the code.
What I discovered is that although og_users_role_init() runs and alters the user roles and permissions earlier on, it also happens to as a side-effect set the menu router item for the node/add/page or whatever path in the process. The problem is that at the time the menu router item gets set, the system hasn't determined that the user has rights to access that path.
Once this menu router item is set, the system will not try to determine it again.
I looked around in menu.inc for some sort of router_item reset function but did not find one so instead I brought over some of the code from menu.inc and used that to "re-get" the menu item and then use that new router item to go back and set the router item correctly.
Not sure if that is clear but if you look at the patch, I think it will be clearer than my attempt to describe it here.
What I am not sure of is whether this is an appropriate way to handle things. For example, I have to call what I think is intended as an internal function to menu.inc, _menu_translate(). Is that okay? Is there a better way to accomplish this?
Would appreciate if I could get feedback on whether this is the right approach.
Thanks!
Comment #14
wdouglascampbell commentedI wrote a comment over on #794548: Once install i18n, OG user role stop working regarding this issue and in the process another idea came to mind on how to solve this. This patch takes a slightly different approach by working around the i18n issue. The idea is that the only reason i18n being installed is a problem is that it introduces the possibility of calling menu_get_item() before we have all of our access permissions altered. In looking at the i18n code though, it seems that if the i18n_selection_mode is off than menu_get_item() will not end up being called (or at least not so early in the process).
This patch simply saves the original selection mode, resets the selection mode to off and finally restores the original selection mode before leaving the og_user_role_init() function.
Which patch is the better way to go?
Comment #15
wdouglascampbell commentedOne more thing to note is that neither of these two patches addresses the problem mentioned in #1 that gids[] parameter must be past with a create node request. This is not critical for a brand new page but is problematic for translations because their is no add translation link that appears in the Group Details block.
I guess for now, I can ask users to manually added the gids[] parameter but that isn't going to really make sense to them so I would prefer to have a more user friendly solution.
One idea would be to check the node that the translation is for and get its group id and then use this in lieu of the gids[] parameter.
I also wonder if something like this could also be done so that the create content option from the navigation menu could be used as well. In this case, it could see what groups the user is able to post to and then use one of them to provide a gids[] parameter for the create operation.
Comment #16
spacereactor commentedTHANK wdouglascampbell for patch #14, i not sure which way is best but i using #14. For the translate part, my work around the problem, using auto translate http://drupal.org/project/i18n_auto if user creating a new group post and choose a language and not using "Language neutral" it will translate that node to all other languages using google. Currently i18n Auto Translate can auto translate the title and body but now user can now use edit the translated node since the node already been created and bypass create new translate node.
update:
I make a mistake, 18n auto translate only help to create translate but it doesn't link it to any group type so my way doesn't help with group post translation. :(
Comment #17
spouilly commentedHi there,
After solving my issue (see comment #1), I actually ended up being bitten by the bug Once installed i18n, OGUR stop working, and while investigating the issue I noticed that installing the module "OG Content Type Access" would solve the issue (I did not really investigate more than that, because I was not keen on using this module, hence I removed it and got "stuck" with a new "Acess Denied" message [different from the one in #1]).
Applying patch #14 seems to solve the problem on my side. Thanks again.
Cheers,
Sylvain
Comment #18
spacereactor commented#14 only solve part of the problem, it allow OGUR to create group post but there still isn't way to translate the group post node yet with OGUR. See remark #15
Comment #19
wdouglascampbell commentedGuys,
I found a problem in my patch provided in #14. It was causing the language to be complete turned off. The following patch, I believe, solves the problem and I think is the correct approach of all the methods I have provided so far.
Doug
Comment #20
spacereactor commented#19 work but the translate part still no solution. It just not practical to teach the user how to manually insert ?gids[]=groupid for translation. Any suggestion?
Comment #21
mparker17After reading through the comments, I am starting to think that this thread actually addresses two separate issues. Here's what I see:
i18nis enabled. The root cause is thati18ncallsmenu_get_item()which ultimately results in anode_access('create', ...)check whileog_user_rolesis still initializing. In other words, the permissions are checked beforeog_user_roleshas had a chance to grant them. This suggests a problem withog_user_roles.og_user_rolesmodule needs some context to know whether or not to assign a role, and it cannot find that context unless thegids[]parameter is passed in the "add translation" link (i.e.: HTTP GET). Because I haven't looked into this problem in depth (yet), I do not know the root cause of this problem, but I suspect thatog_user_rolesis failing to get the context properly (since translation works fine inog).(Note that I cannot tell exactly which one of the above issues are being discussed in comments #7, #9, #11 and #12)
While the symptoms of both issues are the same, the steps taken to reproduce the second problem are different. Additionally, the
gids[]URL parameter is passed in the first issue; so I'm starting to suspect that the root causes are also different.To solve all of this confusion, I propose the following steps. Please let me know what you think:
i18n.Comment #22
mparker17(fulfills suggestion 2 in comment #21)
Steps to Reproduce:
og_user_roles-6.x-4.1(to satisfy dependencies, downloadog-6.x-2.1andviews-6.x-2.10). Disable any modules that are not required.Administer -> Content management -> Content types, chooseAdd content type, and create a new content type (in this example, the content type will begroupand name will beGroup), setting this content type'sOrganic groups usagetoGroup nodeAdminister -> Content management -> Content types, chooseAdd content type, and create a new content type (in this example, the content type will begroup_standardpost, and name will beStandard Post), setting this content type'sOrganic groups usagetoStandard group postAdminister -> Site building -> Blocks, ensure that the block namedGroup detailsis not disabled (in this example, I put it inRight sidebar).Administer -> User management -> Users, add a new user (in this example, their username will betestuser)Administer -> User management -> Roles, add a new role (in this example, the role will betestrole)Administer -> User management -> Permissions, check off the permissioncreate group_standardpost contentfortestroleAdminister -> Organic groups -> User roles, underDefault role assignments, set theDefault role for new group membersto betestrole.Create content -> Group, create a new group (in this example, the title and description will betestgroup)Administer -> Content management -> Post settings, underNode access status, chooseRebuild permissions.testuserGroups, clickJoinin theJoin Linkcolumn of the table next totestgroup, and confirm that you want to join the group.Groups, clicktestgroupin theGroupcolumn of the tableCreate Standard Post(noting that you get a standard node create form); create a new nodetestuseri18n:i18n-6.x-1.4, and enable theInternationalizationmodule (to satisfy dependencies,Content translationandlocalealso need to be enabled)testuserGroups, clicktestgroupin theGroupcolumn of the tableCreate Standard Post, and note that you get an Access DeniedExpected Functionality:
testusershould be able to add a node when internationalization is turned on.Stack Trace
Getting the Stack Trace
To get the stack trace, I copied the core
blogmodule into/sites/default/modules/, and modifiedfunction blog_access($op, $node, $account)as follows:I then essentially followed the "Steps to Reproduce" above starting from step 1.3.2; except that I used
bloginstead ofgroup_standardpost.I chose the
blogmodule because it's short and simple.Notes:
I'm marking this bug as
criticalbecause it describes a problem that prevents users from adding content to a site through the normal use of this module.Comment #23
mparker17Fulfilling comment #21's step 3, I am setting the
statusof this bug toneeds reviewbecause @wdouglascampbell has submitted two patches, in #13 and #19, which need to be evaluated by the maintainers of this module.Comment #24
wdouglascampbell commented@mparker17, thanks for adding the clarification. I hope that this gets the attention of the module maintainers soon.
Let me clarify two issues:
1. First, the only patch that needs review is the one posted in #19. The patch in #13 does not work in all cases.
2. The issue addressed by comments #7, #9, #11, #12 where are referring to the original issue of being unable to create a new node when i18n is enabled.
Comment #25
wdouglascampbell commentedFullfilling comment #21's step 1 by creating #808494: Access denied when translating node if restricted to a role assigned by og_user_roles for the node translation issue.
Comment #26
jvieille commentedSubscribe
Comment #27
sashainparisDifferent usage scenarii, same issues: patch #19 works great!
Thanks a lot.
Comment #28
juanjo_vlc commentedHi, I think i've found a solution.
The problem is that og_user_roles are not loaded at correct place. Them must be loaded on og_set_group_context. When you set on what group are you, is the right moment to change the roles, or not?
I've added this to og.module at line 802 and it works for me.
Function finally likes that:
This change the rules and this issue is shared between og an og_user_roles as long as og does not provide a hook to do things on context change.
I'll provide a path on wednsday.
Comment #29
juanjo_vlc commentedI've proposed the addition of a hook in og module to invoke other modules when setting context on http://drupal.org/node/1557250#comment-5944956 and I provided a patch for it.
This is a complementary patch for use with it, so you need both patches to solve the access to node/add/[type] page, this is not a problem with i18n module, instead is with access checks order, because roles are added to users too late.
Comment #30
jasonawant@wdouglascampbell,
I've tested the patch in comment #13 and it seems to work well. I do not think the original bug described in this issue was related to i18n. I was experiencing this issue without i18n enabled and this patch resolved it. Thanks, Jason.
Comment #31
amstel commentedI agree with #30. Patch on comment #13 solved my issue of not applying the proper roles in the node/add/content for my custom content types.
Comment #32
fuzzy76 commentedPatch from #19 re-rolled against latest stable.
Comment #33
fuzzy76 commentedPatch from #29 rolled against latest stable.
Comment #34
fuzzy76 commented#29 had a variable error which also carried through to #33. Fixed here and rolled against latest stable.