platform
platform copied to clipboard
`byAccess` method returns empty collection but there are definitely users with provided permission
Describe the bug When I'm using
User::byAccess('projects.commit')->get();
I'm getting empty collection. At the same time this
User::find(1)->hasAccess('projects.commit');
return true
.
While digging deeper I found out that if I change single line of scopeByAnyAccess
method of UserAccess
trait
// from
$builder->orWhere('permissions->'.$permit, true);
// to
$builder->orWhere('permissions->'.$permit, 1);
I'm getting my collection. Weird part that yesterday it worked fine, but I didn't know, what has been changed... I'm extending model so there is no big deal but I'm curios what may cause such problem and does changing true
to 1
is a good solution?
Additional context I'm using Laravel Sail with default Dockerfile for PHP 8.0
PHP version - 8.0.20 Laravel - 9.19.0 Orchid 12.6.2
Both Role
and User
models extended like
namespace App\Models;
use Orchid\Platform\Models\Role as OrchidRole;
class Role extends OrchidRole
{}
but there is nothing fancy
Same on my side...
Hello First issue for me so sorry if I mistake the good behavior and place
But I have also issue with permission but I found the root of the problem Let me share User::byAccess('platform.index')->get()
This command retrieve only 1 row even if more users have this permission
The root problem is that users who have the permission from the panel form and not from the command line are different
Table User field permission Commandline : { "platform.index": true,... } Input Permission With Admin Panelcheckbox: { "platform.index": "1",... }