Forked from
DM / dm-docs
261 commits behind, 839 commits ahead of the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
userRouteDescriptor.py 2.82 KiB
#!/usr/bin/env python
#
# User route descriptor.
#
from dm.common.utility.configurationManager import ConfigurationManager
from userInfoSessionController import UserInfoSessionController
class UserRouteDescriptor:
@classmethod
def getRoutes(cls):
contextRoot = ConfigurationManager.getInstance().getContextRoot()
# Static instances shared between different routes
userInfoSessionController = UserInfoSessionController()
# Define routes.
routes = [
# Get user info list
{
'name' : 'getUsers',
'path' : '%s/users' % contextRoot,
'controller' : userInfoSessionController,
'action' : 'getUsers',
'method' : ['GET']
},
# Get user by id
{
'name' : 'getUserById',
'path' : '%s/users/:(id)' % contextRoot,
'controller' : userInfoSessionController,
'action' : 'getUserById',
'method' : ['GET']
},
# Get user by username
{
'name' : 'getUserByUsername',
'path' : '%s/usersByUsername/:(username)' % contextRoot,
'controller' : userInfoSessionController,
'action' : 'getUserByUsername',
'method' : ['GET']
},
# Add user system role
{
'name' : 'addUserSystemRole',
'path' : '%s/userSystemRoles/:(username)/:(roleName)' % contextRoot,
'controller' : userInfoSessionController,
'action' : 'addUserSystemRole',
'method' : ['POST']
},
# Delete user system role
{
'name' : 'deleteUserSystemRole',
'path' : '%s/userSystemRoles/:(username)/:(roleName)' % contextRoot,
'controller' : userInfoSessionController,
'action' : 'deleteUserSystemRole',
'method' : ['DELETE']
},
# Add user experiment role
{
'name' : 'addUserExperimentRole',
'path' : '%s/userExperimentRoles/:(username)/:(roleName)/:(experimentName)' % contextRoot,
'controller' : userInfoSessionController,
'action' : 'addUserExperimentRole',
'method' : ['POST']
},
# Delete user experiment role
{
'name' : 'deleteUserExperimentRole',
'path' : '%s/userExperimentRoles/:(username)/:(roleName)/:(experimentName)' % contextRoot,
'controller' : userInfoSessionController,
'action' : 'deleteUserExperimentRole',
'method' : ['DELETE']
},
]
return routes