2

This worked fine last week when the site was in development:

{% requirePermission 'editEntries:1' %}

We made the site live a few days ago. I dont know if its related, but when I now go to pages with this on, I am getting

HTTP 403 – Forbidden – yii\web\ForbiddenHttpException
User is not permitted to perform this action

I have doubled checked all settings, they are still the same. The logged in user getting this message is in a group that is allowed to editEntries for section 1.

Thanks

  • Is your targeted section on the live website has the same ID (1) than on your dev environment(s) ? – Maxime Lafrenière Jan 30 at 14:46
3

Assuming you've recently updated to Craft 3.1, if you look in your userpermissions table you'll see that they're now lowercase and using UIDs rather than integer IDs, like this:

editentries:3bb69b06-3e65-4ae5-8d70-6c47c1a88fbe

The only place I can find anything like this documented is in the "Updating Plugins for Craft 3.1" guide

https://craftcms.com/guides/updating-plugins-for-craft-3-1#update-element-source-key-references

  • Oh wow that will be it then. Thanks a lot!. Googling wont return that page as there is no mention of "requirePermission". I didn't think such a major change would get slipped in like this without some warning as it broke our system and functionality. – Laurence Cope Jan 31 at 14:44
  • 1
    Although I have no idea where to get the UID from in the admin. Craft seems to get harder and harder! – Laurence Cope Jan 31 at 14:50
  • Yeah it's in the 3.1.0 changelog entry, and there's a migration in Craft for it: m180518_173000_permissions_to_uid.php but I can't find it documented anywhere else, and there is nowhere in the admin that displays a section's UID - I just read them from the database. I guess you can inspect the checkbox value in the permissions form. – Mike Pepper Jan 31 at 16:24

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.