Twill + Spatie permissions

How would someone go about implementing spatie permissions in Twill. The spatie permissions are pretty comprehensive. For e.g If i wanted certain articles in a module article to be accessible only to a certain group, Twill doesn't have permission management for such a scenario. So how would one implement them in the CMS?
5 Replies
ifox
ifox2y ago
Twill 3 permission management does have this capability now you may still want to manage permissions differently and I'm sure it'd be relatively straightforward to integrate spatie permissions with your modules
.zeenux
.zeenuxOP2y ago
twill permissions allow me to assign a single item to a User, not for a group (i.e a role)
ifox
ifox2y ago
I see. There's a feature that allow adding a permission to all users of s group in s single operation but I guess that's not granular enough for your needs it is technically possible to assign item permissions to groups instead of users, so we might want to make some progress there instead of trying to integrate spatie-permissions?
.zeenux
.zeenuxOP2y ago
that would be ideal How do you assign item permissions to groups? @ifox.dev any pointers?
Patrick Boivin
@.zeenux, I think these should work for programmatic group permissions :
$group->grantModulePermission($permissionName, $model);

$group->grantModuleItemPermission($permissionName, $item);
$group->grantModulePermission($permissionName, $model);

$group->grantModuleItemPermission($permissionName, $item);
Want results from more Discord servers?
Add your server