sebastiaan Posted July 25, 2018 Posted July 25, 2018 I wanna create a migration script that creates fields and being able to set those field's permission but i cant seem to find a way to set a fields permission programmatically
kixe Posted July 25, 2018 Posted July 25, 2018 You can set flags and apply roles allowed to 'view' or 'edit' this field. $field->setRoles(string $type, $roles); // $type = 'edit' or 'view' $field->addFlag(int $flag); $field->removeFlag(int $flag); Reference:https://processwire.com/api/ref/field/https://processwire.com/api/ref/field/set-roles/https://processwire.com/api/ref/field/add-flag/https://processwire.com/api/ref/field/remove-flag/ 2
adrian Posted July 26, 2018 Posted July 26, 2018 Getting OT, but does anyone know why $field doesn't have an addRole method, but $template does: https://processwire.com/api/ref/template/add-role/ Do we think this is a bug that needs reporting?
teppo Posted July 26, 2018 Posted July 26, 2018 4 hours ago, adrian said: Do we think this is a bug that needs reporting? I wouldn't call that a bug, but it would definitely improve API consistency ? 2
adrian Posted July 26, 2018 Posted July 26, 2018 1 hour ago, teppo said: I wouldn't call that a bug, but it would definitely improve API consistency ? https://github.com/processwire/processwire-requests/issues/212 3
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now