How to get Users Email address in an Rest Export View for auth users i build a Rest export view for autocompletion of an textfield. The input should autocomplete email addresses of all logged in users. As admin thats possible, but not as authenticated user, the email addresses get stripped from the result on field access level.

The use case is a share form between users on the same platform ( contact form is not suitable ).

I know this is a security measurement but this platform is for logged in users only and all users are from the same company. 

I could hack around the core functions but i wanted to ask if there is a better way to do this? 

Greetings,

yobottehg
Access to the user fields is controlled by \Drupal\user\UserAccessControlHandler::checkFieldAccess(). Which returns forbidden() for email except if it's the current user or the user has administer users permission (which you obviously don't want to grant your normal users).

That is called by \Drupal\Core\Entity\EntityAccessControlHandler::fieldAccess(), collects the default access and everything returned by hook_entity_field_access(). You can't directly overrrule a forbidden(), but you can implement hook_entity_field_access_alter() and replace the default access check with one that allows access.