add TS API to check current user

This commit is contained in:
Martin Cech
2016-04-25 11:05:13 -04:00
parent af4ebccebb
commit e875690703
+8 -2
View File
@@ -95,12 +95,18 @@ class UsersController( BaseAPIController ):
def show( self, trans, id, **kwd ):
"""
GET /api/users/{encoded_user_id}
GET /api/users/current
Returns a dictionary of information about a user.
:param id: the encoded id of the User object.
"""
# Example URL: http://localhost:9009/api/users/f9cad7b01a472135
user = suc.get_user( trans.app, id )
user = None
# user is requesting data about themselves
if id == "current" and trans.user:
user = trans.user
else:
user = suc.get_user( trans.app, id )
if user is None:
user_dict = dict( message='Unable to locate user record for id %s.' % ( str( id ) ),
status='error' )