Admin_menu appears to be included in the page cache, and not replaced by authcache or personalized... this is a small problem for variable roles... after all, visiting an /admin page is usually not cached, and Drupal will deny you inappropriate access. But it is a problem for the big "Hello username" that appears in the corner, which is incorrect and points to the wrong account.

Since this is such a popular module, it makes sense to have support for it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

znerol’s picture

Sorry for the delay.

Admin Menu uses the page cache in a rather clever way. For each variant (user / role combination) a new hash is calculated and stored in the JavaScript setting Drupal.settings.admin_menu.hash. The hash is appended to the Ajax callback used to load subtrees. This ensures that different subtrees are recorded in the cache for different users/role combinations.

However, on pages cached by authcache, the JavaScript settings will be the same for all users having the same authcache-key (role combination). If an admin hits a subtree which was cached by another admin having the same roles, the user-name of the other admin will be displayed.

There are two ways to fix this problem:

  1. Exclude js/admin_menu/cache/* in Administration » Configuration » System » Authcache » Page Caching Settings
  2. Build an authcache extension which is somehow capable of intercepting the Ajax request responsible for loading the admin-menu and alter the hash in some smart way
jh sio’s picture

Is Admin_menu the same as the core Toolbar module?

I've been attempting to implement hook_preprocess_toolbar() with authcache_user, but I'm struggling to understand how to get settings.authcacheUser in the javascript to actually have values set.

I realize that using the authcache_usercookie example works to dynamically replace the username, but I'd like to avoid setting extra cookies just for this.

Also, what's the difference between p13n settings, assemblies, and fragments?

ioskevich’s picture

Excluding js/admin_menu/cache/* in AuthCache's page caching settings did the trick for me.

znerol’s picture

Status: Active » Needs review
FileSize
3.18 KB

Ok, adding js/admin_menu/cache/* to the list of paths which are excluded by default.

Also implemented replacement of the user-name in the toolbar. This is indeed a bit tricky because the toolbar is in the page_top region. This region is rendered from within template_process_html. However, at this point in time authcache_p13n_preprocess_html already collected all authcache fragments/settings and assemblies and therefore the JS bits from authcache user were not added to the page. Moving authcache_p13n_preprocess_html to a pre-render function solves that problem.

znerol’s picture

Also add support for the shortcut module: Load them via Ajax if a user has the permission to switch the shortcut set.

Status: Needs review » Needs work

The last submitted patch, 5: 2281665-admin-menu-toolbar-5.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
6.96 KB

Hu?

  • znerol committed 0c99a1f on 7.x-2.x
    Issue #2281665 by ohthehugemanatee: Exclude admin menu ajax callback and...
znerol’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.