3

Is it possible to define custom user permissions in Craft? I'm building some front end templates that are only accessible by logged in users. Certain parts of this members page should only be accessible to users with specific permissions. I know that I can create multiple groups and use template logic to show / hide certain pages. However, being able to define custom user permissions would be much more flexible.

Say I want to allow a user to access a form, but I don't want to grant access to the other permissions from a different user group.

{% if currentUser.can('submitForm') %}
    {# show form here #}
{% endif %}
4

You can create a plugin that adds custom user permissions via the registerUserPermissions hook.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.