Resolve "Proxy submission"
Links to relevant issues
Description of changes, providing context that may help others understand the changes
This feature allows to add submissions in the name of another user:
- browse and open a survey with an admin-user
- press the new dropdown option of the button "Start survey" and choose "Start survey as a member"
- choose a member
- enter survey data
- the selected user is named in the survey summary, on the submit button and in the confirm dialog
- the submission data is enriched by the following information: - creator: the user id of the selected member - creatorDetail: email and name of the selected member - proxyUserId: the user id of the proxy user who actually submitted the data - proxyUserDetail: the user email and name of the proxy user
Technical hints:
- in the scope of a submission draft, all requests to the backend contain a header param called
delegateToUserIdwhich can be used by the service controllers - currently, the service endpoints
get /farmos/assetsandpost /submissionsdo use the header value ofdelegateToUserIdto overwrite the caller's user._id - in addition, the endpoint
post /submissionsbackups the actual caller's user._id in a value called res.locals.auth.delegateByUserId, which is then stored in the submissions meta data to allow backtracing of the actual caller
Closes #126 (closed)
Edited by Manuel H.