2

How do I check permission for editing entries belonging to a specific section?

When I try {{currentUser.can('editEntries:'~entry.sectionId) }}, it returns false - and I am sure that currentUser can edit entries from this section.

edit: Its craft 3.1

2
  • Is this Craft 2 or 3?
    – Brad Bell
    Commented Jan 28, 2019 at 0:07
  • @BradBell Its craft 3.1. Commented Feb 3, 2019 at 12:42

1 Answer 1

2

In Craft 3.1, permissions checks are done based on uid now, not id.

This should work:

{{ currentUser.can('editEntries:'~entry.getSection().uid) }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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