Closed no0by5 closed 5 years ago
The only way I can seem to replicate this is by running $user->permissions = 'roles.create'
and writing this to the DB. This writes the string directly to the DB. Then when trying to read back with EloquentUser::hasAccess
I get the mentioned error.
I cant replicate the error with the other steps you gave.
I found the problem. I have my own user model where I overwrite the casts variable. Since the new Sentinel version this is also used by Sentinel's user model to cast the permissions into json. I didn't have this cast in my casts variable, which led to the problem. It would have been helpful if this had been in the update news. https://github.com/cartalyst/sentinel/blob/3.0/src/Users/EloquentUser.php#L64-L71
Your Environment
Expected behaviour
A call to Cartalyst\Sentinel\Users\EloquentUser::getPermissions() should not throw an exception.
Actual behaviour
It throws
Steps to reproduce
In my Middleware i call
abort_unless(($user ? $user->hasAccess($permission) : false), 403);
I tried adding permissions withIn every case the Exception is thrown.
With Sentinel v2 it has been working like this.