v5.9.0 breaks user()->can() verification
MrWeb opened this issue · 10 comments
Describe the bug
I upgraded from 5.7.0 to 5.9.0 and inside blade can()
returns false
when before it was returning true
Versions
- spatie/laravel-permission package version: 5.9.0
- illuminate/framework package
PHP version: 8.1
Database version: MySQL 8.0.27
To Reproduce
Assign a user a permission 'view-CoWorking'
Inside blade check:
@if(auth()->user()->can('view-CoWorking'))
Can
@else
Cannot
@endif
In v 5.9.0: should return "Can" but "Cannot" is returned
In v 5.7.0: should return "Can" and "Can" is correctly returned
i have a similar problem but with permission middleware,
It's always returning me "User does not have the right permissions."
I'm have the same issue on a dev server with version 5.4
"spatie/laravel-permission": "^5.4",
PHP 8.2.1 (cli) (built: Jan 13 2023 10:42:44) (NTS)
Also I'm using a middleware to check the permission on route groups.
edit: I checked my composer.lock and it's pointing to version 5.8.0 on local and 5.9.0 on the server.
https://github.com/spatie/laravel-permission/releases/tag/5.9.0
Please look which of that PRs makes the problem?, maybe could be this #2309
https://github.com/spatie/laravel-permission/releases/tag/5.9.0 Please look which of that PRs makes the problem?, maybe could be this #2309
@erikn69
It worked for me after reverting these PR changes locally
ok, thanks for the feedback
Hi, can somebody test this commit on 5.9.0 erikn69@e357bc0, maybe that fix it
It doesn't work here
Hi, can somebody test this commit on 5.9.0 erikn69@09088c0, what about these
Hi, can somebody test this commit on 5.9.0 erikn69@09088c0, what about these
In my tests, these changes fix the issue
v5.9.1 reverted the change.
There is a new PR for the same, #2321 could you please test it before breaking this again?