gitlabhq/gitlabhq — pull request #3525 by karlhungus (2013-04-05 14:11:11+00:00)
Title: API: admin users can sudo commands as other users

Specifying a header of SUDO or adding a :sudo data with either user id, or username of the user will set the current_user to be that user if your identifying private_token/PRIVATE_TOKEN is an administrator token

Motive: I want to be able to migrate people from other repository management systems to gitlab, I need to be able to do things on their behalf.

Method: when current_user is retrieved check if a SUDO value is set, if so it's not the current user, and the current user is an admin, change current_user to be the sudo specified user (where that is an id, or a username).