Hi,
I didn't check at "Enforce auto logout on admin pages" but even my user 1 gets log out if he stays typing at the node/add page for more than 45min.
I mean...i don't want to keep a user logged if he's viewing a 'normal' page for more than 45min.
But if he's the admin AND is at an admin page i think he has the option to stay there as long as the work needs to be finished.
So, how can i disable auto logout at admin pages?
thanks
Comments
Comment #1
tayzlor commentedpatch to cover this - check if user ID > 1 first before doing anything.
This means the superuser would never get autologged out.
Comment #2
tayzlor commentedComment #3
vomitHatSteve commentedOk. I know this is a fairly old issue, but I think I've got a more elegant solution.
The attached patch. Adds a checkbox to the admin page prompting the admin to consider node/*/edit, node/*/delete, and node/add/* admin pages. (I also fixed the spelling of "then" in the previous checkbox.)
Then I replaced the current "is admin page" logic with an invocation of hook_is_admin_page, which doesn't exist outside of this patch, but really should!
This patch also implements hook_is_admin_page (obviously) and performs the original check as well as the new ones needed for node modification pages.
That's not to say that the previous patch isn't a good idea. These could probably be used concurrently, but this solution solves the original, posted problem more elegantly.
Comment #4
vomitHatSteve commentedFor clarification (since I forgot in my original post), the purpose of hook_is_admin_page being that other modules (specifically admin_theme) can implement it to expand the list of admin pages even further!
Comment #5
johnennew commentedI'm not sure that autologout is the place to define node pages as admin pages using hook_is_admin_page. This will affect the admin page status of node pages outside just autologout.
My preference is to include a new config option which can list path patterns that autologout does not work on. This would work like specifying which URLs a block can appear on. If the path matches any pattern specified then it will not logout when on that page.
Setting to needs work and assigning to me but should anyone want to do it sooner, please feel free to attach a patch (or tell me I'm wrong!)
Needs applying to 7.x-4.x first then backported.
Comment #6
rooby commentedA couple of things:
The hook name hook_is_admin_page() is not ideal as it is not namespaced.
If this module is to add any hooks they should be namespaced with autologout, so it should be hook_autologout_is_admin_page().
Plus, drupal core already has something like this. It is the path_is_admin() function, which uses hook_admin_paths() and hook_admin_paths_alter(), which are tied in with the node_admin_theme variable (via node_admin_paths(), which handles the case that the user has checked the box to make node pages admin pages, in the appearance section of the site administration.
So it would be something along the lines of:
Re the first patch, I would suggest making a user 1 exception a separate setting.
[EDIT] fixed code example.
Comment #7
johnennew commentedI like this fix since it properly captures all paths described as admin by the site.
Comment #8
johnennew commentedPatch with tests for review
Comment #9
johnennew commentedI don't see any reason to delay this inclusion - it;s pretty innocuous and the tests pass.
Committed to 7.x-4.x branch - I don;t think there is an equivalent for Drupal 6 so not back porting - please reopen if you know differently.
Comment #10
rooby commentedFor drupal 6, this is what drupal core does in system_init():
Comment #11
johnennew commentedAh, ok. probably worth adding this.
6.x-4.x patch with tests attached.
Comment #12
johnennew commentedTests pass - committing to 6.x-4.x and closing.