i use entrust before to control acl in laravel when my project is still laravel 4, and now with laravel 5.2 entrust no longer work, especialy in route filtering...
and then i find this package and trying to use it.. but still got a lot of question, so to make it more simple i will explain my use case when i use entrust: first i want to make a permission for create, view, update and delete for article, in entrust i will create permission like create_article, view_article, update_article and delete_article. But now in kodeine when i create permission there is "slug" so i tried to do this like in documentation say
$permUser = $permission->create([
'name' => 'article',
'slug' => [ // pass an array of permissions.
'create' => true,
'view' => true,
'update' => true,
'delete' => true
],
'description' => 'Manange article'
]);
so from what i read it will be just grouping all of my article permission into one place and there is slug with each parameters view,create,update,delete
the problem i see is, if i want to make my users to only can view article... how to do that based on permission that i created up there?
since from documentation the to assignPermission is only give permission name and that mean it will include all slug in there and it will be all true?
so if i want to make users only can view article i need to create something like
$permUser = $permission->create([
'name' => 'article_view',
'slug' => [ // pass an array of permissions.
'view' => true,
],
'description' => 'view article'
]);
and if i want to make users only can create article then i will mean i need to create
$permUser = $permission->create([
'name' => 'article_create',
'slug' => [ // pass an array of permissions.
'create' => true,
],
'description' => 'create article'
]);
then whats the point of slug is it just pretty much the same like role but with parameter in slug?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire