I'm writing a simple in-house frontend to Subversion. We've got an Apache setup serving up the SVN repositories thanks to WebDAV. Also, authentication is done through an Apache realm and Open Directory. For what it's worth, this is basically a pretty vanilla Mac OS X Server 10.6 setup.
Now, some of the tasks our front end is responsible of kicking off need to know the username of the user calling the action. For instance, creating a repository needs it so that we get proper logs of who actually created it. If I don't supply this information, SVN just uses the process that created it which in our case is the user running httpd.
I'm doing this in php, but I don't necessarily have to implement this using php. If I can get the information in a shell script that's fine too. What matters is that I somehow get the information. The solution I first developed, which I assumed worked since it correctly reported my user name, is simply calling:
get_current_user();
However, this seems to always return my user name, even though some other user is kicking off the action while being logged in to the realm. Is there a way to get the correct user?