def __init__(self, options): self.options = options mapper = routes.Mapper() db_api.configure_db(options) # Token Operations auth_controller = AuthController(options) mapper.connect("/v2.0/tokens", controller=auth_controller, action="authenticate", conditions=dict(method=["POST"])) # Tenant Operations tenant_controller = TenantController(options) mapper.connect("/v2.0/tenants", controller=tenant_controller, action="get_tenants", conditions=dict(method=["GET"])) # Miscellaneous Operations version_controller = VersionController(options) mapper.connect("/v2.0/", controller=version_controller, action="get_version_info", conditions=dict(method=["GET"])) mapper.connect("/v2.0", controller=version_controller, action="get_version_info", conditions=dict(method=["GET"])) # Static Files Controller static_files_controller = StaticFilesController(options) mapper.connect("/v2.0/identitydevguide.pdf", controller=static_files_controller, action="get_pdf_contract", conditions=dict(method=["GET"])) mapper.connect("/v2.0/identity.wadl", controller=static_files_controller, action="get_identity_wadl", conditions=dict(method=["GET"])) mapper.connect("/v2.0/xsd/{xsd}", controller=static_files_controller, action="get_pdf_contract", conditions=dict(method=["GET"])) mapper.connect("/v2.0/xsd/atom/{xsd}", controller=static_files_controller, action="get_pdf_contract", conditions=dict(method=["GET"])) super(KeystoneAPI, self).__init__(mapper)
def __init__(self, options): self.options = options mapper = routes.Mapper() db_api.configure_db(options) # Token Operations auth_controller = AuthController(options) mapper.connect("/v2.0/tokens", controller=auth_controller, action="authenticate", conditions=dict(method=["POST"])) mapper.connect("/v2.0/tokens/{token_id}", controller=auth_controller, action="validate_token", conditions=dict(method=["GET"])) mapper.connect("/v2.0/tokens/{token_id}", controller=auth_controller, action="delete_token", conditions=dict(method=["DELETE"])) # Tenant Operations tenant_controller = TenantController(options) mapper.connect("/v2.0/tenants", controller=tenant_controller, action="create_tenant", conditions=dict(method=["PUT", "POST"])) mapper.connect("/v2.0/tenants", controller=tenant_controller, action="get_tenants", conditions=dict(method=["GET"])) mapper.connect("/v2.0/tenants/{tenant_id}", controller=tenant_controller, action="get_tenant", conditions=dict(method=["GET"])) mapper.connect("/v2.0/tenants/{tenant_id}", controller=tenant_controller, action="update_tenant", conditions=dict(method=["PUT"])) mapper.connect("/v2.0/tenants/{tenant_id}", controller=tenant_controller, action="delete_tenant", conditions=dict(method=["DELETE"])) # Tenant Group Operations mapper.connect("/v2.0/tenants/{tenant_id}/groups", controller=tenant_controller, action="create_tenant_group", conditions=dict(method=["PUT", "POST"])) mapper.connect("/v2.0/tenants/{tenant_id}/groups", controller=tenant_controller, action="get_tenant_groups", conditions=dict(method=["GET"])) mapper.connect("/v2.0/tenants/{tenant_id}/groups/{group_id}", controller=tenant_controller, action="get_tenant_group", conditions=dict(method=["GET"])) mapper.connect("/v2.0/tenants/{tenant_id}/groups/{group_id}", controller=tenant_controller, action="update_tenant_group", conditions=dict(method=["PUT"])) mapper.connect("/v2.0/tenants/{tenant_id}/groups/{group_id}", controller=tenant_controller, action="delete_tenant_group", conditions=dict(method=["DELETE"])) mapper.connect("/v2.0/tenants/{tenant_id}/groups/{group_id}/users", controller=tenant_controller, action="get_users_tenant_group", conditions=dict(method=["GET"])) mapper.connect( "/v2.0/tenants/{tenant_id}/groups/{group_id}/users/{user_id}", controller=tenant_controller, action="add_user_tenant_group", conditions=dict(method=["PUT"])) mapper.connect( "/v2.0/tenants/{tenant_id}/groups/{group_id}/users/{user_id}", controller=tenant_controller, action="delete_user_tenant_group", conditions=dict(method=["DELETE"])) # User Operations user_controller = UserController(options) mapper.connect("/v2.0/users", controller=user_controller, action="create_user", conditions=dict(method=["PUT", "POST"])) mapper.connect("/v2.0/users", controller=user_controller, action="get_users", conditions=dict(method=["GET"])) mapper.connect("/v2.0/users/{user_id}", controller=user_controller, action="get_user", conditions=dict(method=["GET"])) mapper.connect("/v2.0/users/{user_id}", controller=user_controller, action="update_user", conditions=dict(method=["PUT"])) mapper.connect("/v2.0/users/{user_id}", controller=user_controller, action="delete_user", conditions=dict(method=["DELETE"])) mapper.connect("/v2.0/users/{user_id}/password", controller=user_controller, action="set_user_password", conditions=dict(method=["PUT"])) mapper.connect("/v2.0/users/{user_id}/tenant", controller=user_controller, action="update_user_tenant", conditions=dict(method=["PUT"])) # Test this, test failed mapper.connect("/v2.0/users/{user_id}/enabled", controller=user_controller, action="set_user_enabled", conditions=dict(method=["PUT"])) mapper.connect("/v2.0/users/{user_id}/groups", controller=user_controller, action="get_user_groups", conditions=dict(method=["GET"])) mapper.connect("/v2.0/tenants/{tenant_id}/users", controller=user_controller, action="get_tenant_users", conditions=dict(method=["GET"])) #Global Groups groups_controller = GroupsController(options) mapper.connect("/v2.0/groups", controller=groups_controller, action="create_group", conditions=dict(method=["PUT", "POST"])) mapper.connect("/v2.0/groups", controller=groups_controller, action="get_groups", conditions=dict(method=["GET"])) mapper.connect("/v2.0/groups/{group_id}", controller=groups_controller, action="get_group", conditions=dict(method=["GET"])) mapper.connect("/v2.0/groups/{group_id}", controller=groups_controller, action="update_group", conditions=dict(method=["PUT"])) mapper.connect("/v2.0/groups/{group_id}", controller=groups_controller, action="delete_group", conditions=dict(method=["DELETE"])) mapper.connect("/v2.0/groups/{group_id}/users", controller=groups_controller, action="get_users_global_group", conditions=dict(method=["GET"])) mapper.connect("/v2.0/groups/{group_id}/users/{user_id}", controller=groups_controller, action="add_user_global_group", conditions=dict(method=["PUT"])) mapper.connect("/v2.0/groups/{group_id}/users/{user_id}", controller=groups_controller, action="delete_user_global_group", conditions=dict(method=["DELETE"])) #Roles and RoleRefs roles_controller = RolesController(options) mapper.connect("/v2.0/roles", controller=roles_controller, action="get_roles", conditions=dict(method=["GET"])) mapper.connect("/v2.0/roles/{role_id}", controller=roles_controller, action="get_role", conditions=dict(method=["GET"])) mapper.connect("/v2.0/users/{user_id}/roleRefs", controller=roles_controller, action="get_role_refs", conditions=dict(method=["GET"])) mapper.connect("/v2.0/users/{user_id}/roleRefs", controller=roles_controller, action="create_role_ref", conditions=dict(method=["POST"])) mapper.connect("/v2.0/users/{user_id}/roleRefs/{role_ref_id}", controller=roles_controller, action="delete_role_ref", conditions=dict(method=["DELETE"])) #BaseURLs and BaseURLRefs baseurls_controller = BaseURLsController(options) mapper.connect("/v2.0/baseURLs", controller=baseurls_controller, action="get_baseurls", conditions=dict(method=["GET"])) mapper.connect("/v2.0/baseURLs/{baseURLId}", controller=baseurls_controller, action="get_baseurl", conditions=dict(method=["GET"])) mapper.connect("/v2.0/tenants/{tenant_id}/baseURLRefs", controller=baseurls_controller, action="get_baseurls_for_tenant", conditions=dict(method=["GET"])) mapper.connect("/v2.0/tenants/{tenant_id}/baseURLRefs", controller=baseurls_controller, action="add_baseurls_to_tenant", conditions=dict(method=["POST"])) mapper.connect( "/v2.0/tenants/{tenant_id}/baseURLRefs/{baseurls_ref_id}", controller=baseurls_controller, action="remove_baseurls_from_tenant", conditions=dict(method=["DELETE"])) # Miscellaneous Operations version_controller = VersionController(options) mapper.connect("/v2.0/", controller=version_controller, action="get_version_info", conditions=dict(method=["GET"])) mapper.connect("/v2.0", controller=version_controller, action="get_version_info", conditions=dict(method=["GET"])) # Static Files Controller static_files_controller = StaticFilesController(options) mapper.connect("/v2.0/identitydevguide.pdf", controller=static_files_controller, action="get_pdf_contract", conditions=dict(method=["GET"])) mapper.connect("/v2.0/identity.wadl", controller=static_files_controller, action="get_identity_wadl", conditions=dict(method=["GET"])) mapper.connect("/v2.0/xsd/{xsd}", controller=static_files_controller, action="get_xsd_contract", conditions=dict(method=["GET"])) mapper.connect("/v2.0/xsd/atom/{xsd}", controller=static_files_controller, action="get_xsd_atom_contract", conditions=dict(method=["GET"])) super(KeystoneAdminAPI, self).__init__(mapper)