Merge pull request #2243 from martenson/check-curr-ts-user

add TS API to check current user
This commit is contained in:
John Chilton
2016-04-25 12:33:04 -04:00
+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' )