TC
Twill CMS•2y ago
.zeenux

Twill Role based access

How would i go about adding a Role based access to CMS Components and its entries. For e.g in an image module i would want to be able to allow or deny access (on the front end) to certain roles.
6 Replies
ifox
ifox•2y ago
Hi @.zeenux you can either use the new permission management feature if you want to use the same users as the CMS users (using the view permission to allow access on the frontend), or build something with your own user model with a browser field on your module. In any case Twill being headless you'll need to integrate the authorization yourself on your frontend controllers by checking the permission of the authenticated user.
.zeenux
.zeenuxOP•2y ago
Ideally i would want to attach roles/group to any resource, article, media etc. And i would want the cms to check for access rights before providing the requested resource let say an article. But i gather it isn't easy to implement. However would it be possible to add a role field to the migration, and return the resource based on that field?
ifox
ifox•2y ago
it seems like you are looking for exactly the permission management feature: https://twillcms.com/docs/user-management/advanced-permissions.html
Twill
ifox
ifox•2y ago
the most complex level lets you manage permissions with groups and roles down to individual records
.zeenux
.zeenuxOP•2y ago
That's exactly what i wanted, however the documentation of this feature is pretty limited.
ifox
ifox•2y ago
for now 😉 try it, the UI is quite self explanatory
Want results from more Discord servers?
Add your server