sebastienheyd / boilerplate

Laravel AdminLTE 3 Boilerplate package with blade components, users, roles and permissions management
MIT License
219 stars 65 forks source link

user role do not remove/change after user edit #99

Closed mmrtonmoybd closed 1 month ago

mmrtonmoybd commented 1 month ago

Problem 1: When I edit a user that have assign backend_user role . If I change the role of that user and do not assign any new role for that user (Previous backend_user role is unchecked when editing because of I do not to assign any role for that user). Then in user list show the blank in role for that user (it is correct) but in user edit page the previous role is checked in role selection option. (Incorrect because this user has not any assign role currently ). When that the user is login the user can access everything like there previous role but currently that user has not any assign role .

Same as admin role . When the user had admin role in before after edit, the role is change or not assign any role this user. But this user can permission everything like admin

Problem 2: When delete the backend_user role form the role list (no role is available except admin). After deleted the role when adding new user from administration panel(I set the role to admi role) . After edit this user and unchecked the admin role(didn't assign any role) and submit edit form . Then in user list show nothing in role column for that user this is correct. But in user edit page for that user automatically checked admin role by default in edit page (this user have not any assign role) this is incorrect. But when this user is login that time this user get the admin permission(previous role permission like admin but currently not any role assign) (incorrect). (Same as problem 1)

Note: sorry for my poor English 😞

sebastienheyd commented 1 month ago

I can't reproduce the issue; the role remains unchecked in the user profile. Did you make sure to click "save" in the top right corner?

When you click "save," the role_user table is updated. See if the table is updated.

sebastienheyd commented 1 month ago

Can you make a video screen capture?

mmrtonmoybd commented 1 month ago

Works perfectly in localhost(local mode) but in live server(shared host) with production mode do not work. watch the video. problem in user edit page and some role logic .
I share a screen record of live server . Attach google drive video link: https://drive.google.com/file/d/1sirbhEWcwcqAwdPdnQmRn7SiEvfA2xEj/view

Laravel: 11.* (Latest version) @sebastienheyd

sebastienheyd commented 1 month ago

Do you have cache enabled in production ?

mmrtonmoybd commented 1 month ago

Do you have cache enabled in production ?

Yes, I cache config, route, view and event with artisan optimize command. Cache helps me for faster loading the application.

sebastienheyd commented 1 month ago

Something in the logs ? I still can't reproduce.

Just after clicking on "save" can you check in the db if the table role_user is updated ?

mmrtonmoybd commented 1 month ago

Something in the logs ? I still can't reproduce.

Just after clicking on "save" can you check in the db if the table role_user is updated ?

Yes, updated in db role_user table. But this change do not effect on this user ability because user can access as before(if I don't assign any role) .

Its only effect when I hit optimize:clear command and disabled cache.

Maybe it cache related issue, after changing in db role_user table, it doesn't effect on application until cache clear.

But without cache system is too slowly loading everything in application.

sebastienheyd commented 1 month ago

Yes this is a cache related issue, which cache system do you use ?

mmrtonmoybd commented 1 month ago

Yes this is a cache related issue, which cache system do you use ?

I am using database cache system. How to solve this cache related issue?

sebastienheyd commented 1 month ago

Can you test setting LARATRUST_ENABLE_CACHE=false in your .env file on production

mmrtonmoybd commented 1 month ago

Can you test setting LARATRUST_ENABLE_CACHE=false in your .env file on production

Yes, now it's working perfectly. But LARATRUST_ENABLE_CACHE=false mean laratrust don't use cache system so it may impact faster loading.

Is it your issue or laratrust issue? @sebastienheyd @

sebastienheyd commented 1 month ago

OK, I managed to reproduce the problem. The bootLaratrustUserTrait() method was missing in the boot of the User model. I'll fix that today.

mmrtonmoybd commented 1 month ago

@sebastienheyd Also fix this frontend issue: When a long “File path” name in log viewer that break the responsive in mobile/android view. It is not responsive in mobile/Android device when the File path is large. I attach some screenshots here. See the last screenshot, how break the responsive screen.

1st image: Screenshot_20241002-165705

2nd image: Screenshot_20241002-165713

sebastienheyd commented 1 month ago

Everything is fixed in v8.0.5. Can you upgrade and see if everything is ok.

mmrtonmoybd commented 1 month ago

Everything is fixed in v8.0.5. Can you upgrade and see if everything is ok.

Yeah, everything is ok. Now all are perfectly working.

Thank you for fixing bug quickly. ❤️❤️