JosephSilber / bouncer

Laravel Eloquent roles and abilities.
MIT License
3.43k stars 330 forks source link

Can helper returning true after removing role from the user #634

Open justasSendrauskas opened 1 year ago

justasSendrauskas commented 1 year ago

using Bouncer v1.0.1 In unit tests i have:

allow('some-admin')->to('manage', Some::class);
Bouncer::dontCache();

$user->assign('some-admin');
Bouncer::refresh();

$user->isA('some-admin'); // returns true
$user->can('manage', Some::class); // returns true

$user->retract('some-admin');
Bouncer::refresh();

$user->isA('some-admin'); // returns false
$user->can('manage', Some::class); // returns true where it should be false

not using any scopes

JosephSilber commented 1 year ago

That doesn't sound right. Testing it myself, I can't reproduce it. Could you maybe make a small repository demonstrating this issue?

justasSendrauskas commented 1 year ago

thank you for getting back so promptly, did not expect that.

It leads me thinking it might be some configuration, will investigate/create repo, and report back