DEV: Allow plugins to mark user custom fields as editable only by staff

This adds a staff_only parameter to the register_editable_user_custom_field API. The default is false, to maintain backwards compatibility.
This commit is contained in:
David Taylor
2019-10-11 09:57:55 +01:00
parent 3bcfa158a7
commit 67787799bb
4 changed files with 40 additions and 9 deletions

View File

@ -141,9 +141,9 @@ class Plugin::Instance
end
end
def register_editable_user_custom_field(field)
def register_editable_user_custom_field(field, staff_only: false)
reloadable_patch do |plugin|
::User.register_plugin_editable_user_custom_field(field, plugin) # plugin.enabled? is checked at runtime
::User.register_plugin_editable_user_custom_field(field, plugin, staff_only: staff_only) # plugin.enabled? is checked at runtime
end
end