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

Brad Bell
  • 67,440
  • 6
  • 73
  • 143
Piotr Pogorzelski
  • 1,286
  • 7
  • 18

1 Answers1

2

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

This should work:

{{ currentUser.can('editEntries:'~entry.getSection().uid) }}
Brad Bell
  • 67,440
  • 6
  • 73
  • 143