lock-laravel icon indicating copy to clipboard operation
lock-laravel copied to clipboard

Working with resource_type = 'privilege'

Open brazorf opened this issue 8 years ago • 0 comments

I'm trying to fetch a list of all permissions, in order to build a backend.

I'm using this query to fetch all available permissions:

$permissions = \DB::table('lock_permissions')
    ->groupBy('type')
    ->groupBy('action')
    ->groupBy('resource_type')
    ->groupBy('resource_id')
    ->get();

I've noticed that when a $lock->deny() is issued, a new record with type='restriction' and resource_type='privilege' is inserted.

Is it safe to consider all records with resource_type=privilege as restrictions?

EDIT However, maybe the Driver itself should define specific methods to fetch this kind of information, in order to decouple from the database structure.

brazorf avatar Oct 28 '15 11:10 brazorf