Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu Caching causing menu use old role menu access, not real menu #1853

Open
benyaminl opened this issue Dec 19, 2024 · 0 comments
Open

Menu Caching causing menu use old role menu access, not real menu #1853

benyaminl opened this issue Dec 19, 2024 · 0 comments

Comments

@benyaminl
Copy link

Bug report

Title

Login using different user in same computer after log out, menu list in side bar still cached.

Issue Description

Menu list not following by roles, cached on singleton causing unexpected result in menu list not following roles

Preconditions

Please provide as detailed information about your environment as possible.

1. V2.0.4
2. PHP 8.3

Steps to reproduce

It is important to provide a set of clear steps to reproduce this bug.If relevant please include code samples.

1. Create 2 user with different role with different menu access
2. Login with user one, see menu, then log out
3. Login with user two, see menu, and menu stuck with old role, sometimes work and can be retested, sometimes not.

Expected result

  1. If want to use cache, use better caching strategy with proper way to cache
  2. Menu should be filtered with assigned role
  • [Screenshots, logs or description]

Actual result

Menu cached unexpectedly.
related code : https://github.com/krayin/laravel-crm/blob/master/packages/Webkul/Core/src/Menu.php#L53-L57

I don't think this is a good way to use static in the code, even it's in singleton in laravel or even with https://www.php.net/manual/en/language.oop5.static.php#118097 it' bad bad choices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant