Whoops! I found that I needed to disable this module because it conflicts with a particular feature of LoginToboggan.
Using LoginToboggan v 1.133, I'm allowing users to set their own password and immediately log in. Users are assigned a non-authenticated role, with permissions no better than an anonymous user. However, these non-authenticated users can still access features that are reserved to authenticated users, like creating content, when admin_menu.module is enabled.
Disabling only admin_menu.module allows LoginToboggan to restrict access as designed.
Comments
Comment #1
pwolanin commentedthis sounds very odd to me- can you give more details on your setup?
Comment #2
mrtoner commentedSure! Running D6.3, with Drupal Administration Menu 6.x-1.0 and LoginToboggan 6.x-1.2 enabled; no additional modules -- core or otherwise -- are enabled.
Pending User is a role that has been created and set as the Non-authenticated role in LoginToboggan. An Authenticated User can Create Product Content, a Pending User cannot. Both can access content.
A menu item, Add Product, has been added to Primary Links, linked to node/add/product. When both modules are enabled, a user assigned the Pending User role can see and access the Add Product menu item. When Drupal Administration Menu is disabled, LoginToboggan behaves normally and the Add Product menu item is not displayed and is not accessible.
Comment #3
pwolanin commentedIs the non-authenticated user actually able to add nodes, or juset see the link?
"Product" is a node type you created with the core node module, or is defined by another module?
This sounds very odd to me since admin menu does not touch anything related to permissions or node access, so I'm guessing that there might be some very incorrect code in LoginToboggan
Comment #4
mrtoner commentedThey can do both. They shouldn't be able to.
Product is a content type created in core.
I'll look in LT for a solution, too.
Comment #5
mrtoner commentedHere's where LT removes the Authenticated User role from LT's non-authenticated role:
With DAM enabled, this code executes as before, but the unset() is for naught! At some point after this, DAM is refreshing $account->roles and the Authenticated User role once again exists.
Comment #6
pwolanin commentedHmm, ok - well DAM isn't "refreshing" them, but it does its work in the page footer. It's possible that by calling various core access callbacks this "refresh" is happening?
Note, however, that DAM should basically exit and do nothing if users do not have its permission. Also, it really does not do anything during the page load until hook_footer (when all the other content and menus are already rendered), except for the user_access call in hook_init. Where in the page load does Login Toboggan run the code above?
Frankly, I think the code aboves looks dumb - why not just give the absolute minimum of permissions to authenticated users, and then increase the permissions by granting another role (approved users or some such) when appropriate?
Comment #7
hunmonk commentedit shouldn't, no
LT performs it's work both during hook_init, and anytime the 'load' op of hook_user is called. IMO this is pretty good coverage, and if it's being unset there's probably a bad approach somewhere in other code that's killing it.
it wasn't a dumb approach when LT was first written. however, after the core decision to remove the auth user from the database, things got trickier. i still think the approach is ok. at this point, it isn't going to change until 7.x at the earliest, so we'll have to live w/ what we have now until then at the very least.
Comment #8
mrtoner commentedLooks like that's exactly what's happening. admin_menu_init() calls user_access('access administration menu')); look what happens in user_access():
$account is NULL, so it's re-initialized with $user. Any ideas to avoid this?
Comment #9
pwolanin commented$account is almost always NULL when user_access() is called, so I don't think that's the problem.
I'd look more fro some place that user_access is getting called with the 3rd param ($reset) as TRUE.
Comment #10
sunThe only change I can see here is the one mentioned by pwolanin: DAM shouldn't do anything if the user does not have access to it.
Comment #11
rickcoates commentedThe incompatibility between LT and DAM is actually related to a problem with LT not resetting the permissions cache when it dynamically removes the 'authenticated user' role (thanks to mrtoner and pwolanin for the discussion on
user_accessthat put me on the trail of the real problem). Because DAM callsuser_accessin its hook_init, if DAM's hook_init is called before LT's, the permissions for the roles set by sess_read (which automatically sets the 'authenticated user' role when a user logs in) will be cached and LT's removal of the 'authenticated user' role will not have the desired effect. I have documented this issue with LT and proposed a patch here: http://drupal.org/node/319438. As I note there, it is also very important that you install a core patch, which fixes a subtle (and nasty) little problem withuser_accessnoted here: http://drupal.org/node/275796 (which also has an attached patch) or else the fix won't work.Comment #12
sunGood. So all we can do in admin menu is commit #10, which does not solve this issue, but looks better to me anyway.
@pwolanin: Do you agree?
Comment #13
sunCommitted patch in #10.