[development] Checking Menu Access for Anonymous User
lists at zufelt.ca
Mon Sep 20 17:16:45 UTC 2010
Good afternoon Adam,
I had a similar question, a while back, here is the answer I received.
In short, no, there is no good approach to this :)
If you do go down the path of changing the global $user object, then
you will want to use session_save_session to make your code look
something like this:
// Don't save the session if the next block of code fails:
// Save the old user account someplace.
$user = user_load(0);
// Some computation....
// Something like this:
$user = $the_old_user
// Its now safe to start saving the session again:
If your 'Computation' in the middle there fails, then the users
session will be saved with the $user object you loaded up, i.e.
they'll get logged out. Annoying at the moment, but if you ever change
it to assign other users to the $user object then you might end up
with people being logged in as other people if the 'computation' fails
for some reason.
Follow me on Twitter
View my LinkedIn Profile
On 2010-09-20, at 1:07 PM, Adam B. Ross wrote:
> Hello all,
> I am trying to determine a good approach to identifying whether a
> specified menu path could be accessed by anonymous users, in an effort
> to implement some kind of baseline cacheable security for an Input
> However, I cannot specify a user with such functions as
> menu_get_item() to ask for the access right of an anonymous user. Is
> there a good approach to this?
> - abr/Grayside
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the development