File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
lib/galaxy/webapps/galaxy Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 5
5
6
6
from galaxy .web import _future_expose_api_anonymous_and_sessionless as expose_api_anonymous_and_sessionless
7
7
from galaxy .web import _future_expose_api as expose_api
8
+ from galaxy .web import _future_expose_api as expose_api_anonymous
8
9
from galaxy .web import require_admin
9
10
from galaxy .web .base .controller import BaseAPIController
10
- from galaxy .managers import configuration
11
+ from galaxy .managers import configuration , users
11
12
from galaxy .queue_worker import send_control_task
12
13
13
14
import logging
@@ -20,6 +21,19 @@ def __init__( self, app ):
20
21
super ( ConfigurationController , self ).__init__ ( app )
21
22
self .config_serializer = configuration .ConfigSerializer ( app )
22
23
self .admin_config_serializer = configuration .AdminConfigSerializer ( app )
24
+ self .user_manager = users .UserManager ( app )
25
+
26
+ @expose_api_anonymous
27
+ def whoami ( self , trans , ** kwd ):
28
+ """
29
+ GET /api/whoami
30
+ Return information about the current authenticated user.
31
+
32
+ :returns: dictionary with user information
33
+ :rtype: dict
34
+ """
35
+ current_user = self .user_manager .current_user ( trans )
36
+ return current_user .to_dict ()
23
37
24
38
@expose_api_anonymous_and_sessionless
25
39
def index ( self , trans , ** kwd ):
Original file line number Diff line number Diff line change @@ -309,6 +309,10 @@ def populate_api_routes( webapp, app ):
309
309
webapp .mapper .connect ( "configuration_version" ,
310
310
"/api/version" , controller = "configuration" ,
311
311
action = "version" , conditions = dict ( method = [ "GET" ] ) )
312
+ webapp .mapper .connect ( "api_whoami" ,
313
+ "/api/whoami" , controller = 'configuration' ,
314
+ action = 'whoami' ,
315
+ conditions = dict ( method = [ "GET" ] ) )
312
316
webapp .mapper .resource ( 'datatype' ,
313
317
'datatypes' ,
314
318
path_prefix = '/api' ,
You can’t perform that action at this time.
0 commit comments