#Override the default auth access functions for the email field

1 messages · Page 1 of 1 (latest)

patent pumice
#

Is it possible to override the default access functionality on the automatically-generated email field present in a collection with auth enabled?

For example, in some cases it is undesirable to allow a user to update their own email address. If the user is an employee, the field should be read-only. The create and update access functions should allow a manager to create/update, but not the actual user.

gilded atlasBOT
fleet locust
#

@patent pumice I think this could be done with a beforeChange hook on the auth enabled collection, though I'm not sure if it would have any side-effects

patent pumice
#

Thanks for your response @fleet locust. I have got this method to work, however, it's sub-optimal because the field still appears as if it is editable. Ideally, it would render as read-only to be consistent with other fields that are also read-only.

fleet locust
#

@patent pumice You can add some custom CSS to make this field "disabled"

#

That's probably the easiest way

patent pumice
#

I see, I have not tried this yet. Thanks @fleet locust! Just out of interest, any other configuration settings one would wish to apply to a field, such as positioning it in the sidebar etc...can any of these be applied to an automatically generated field such as 'email'? I was hoping I could just create a field with the name of email and any options I include would be merged with the auto generated field.

fleet locust
#

@patent pumice This is a common request, and I'm not sure the extent of our abilithy to customize the default email field

#

I think that's like the only auto generated field there is