moacode / craft-fab-permissions

Restrict access to fields and tabs for particular user groups across your Craft elements.
Other
16 stars 9 forks source link

Bypass field restrictions when saving entry #21

Open goraxan opened 4 years ago

goraxan commented 4 years ago

My use case is a user which creates user invitation entries, which have a randomly generated activation code (among other fields like email, firstname, lastname,...). This activation code should be hidden from the user, but it should be randomly generated and saved when creating the invitation. Setting that field in the EVENT_BEFORE_SAVE has no effect since the creating user is not allowed to access that field.

I'm wondering if it's somehow possible to programmatically set restricted fields with a plugin/module when saving an entry.

Thanks