def map_extension_methods(self, mapper, options): # Services services_controller = ServicesController(options) mapper.connect("/OS-KSADM/services", controller=services_controller, action="get_services", conditions=dict(method=["GET"])) mapper.connect("/OS-KSADM/services", controller=services_controller, action="create_service", conditions=dict(method=["POST"])) mapper.connect("/OS-KSADM/services/{service_id}", controller=services_controller, action="delete_service", conditions=dict(method=["DELETE"])) mapper.connect("/OS-KSADM/services/{service_id}", controller=services_controller, action="get_service", conditions=dict(method=["GET"])) #Roles roles_controller = RolesController(options) mapper.connect("/OS-KSADM/roles", controller=roles_controller, action="create_role", conditions=dict(method=["POST"])) mapper.connect("/OS-KSADM/roles", controller=roles_controller, action="get_roles", conditions=dict(method=["GET"])) mapper.connect("/OS-KSADM/roles/{role_id}", controller=roles_controller, action="get_role", conditions=dict(method=["GET"])) mapper.connect("/OS-KSADM/roles/{role_id}", controller=roles_controller, action="delete_role", conditions=dict(method=["DELETE"])) #User Roles mapper.connect("/users/{user_id}/OS-KSADM/{role_id}", controller=roles_controller, action="add_global_role_to_user", conditions=dict(method=["POST"])) mapper.connect("/users/{user_id}/roleRefs", controller=roles_controller, action="get_role_refs", conditions=dict(method=["GET"])) mapper.connect("/users/{user_id}/roleRefs", controller=roles_controller, action="create_role_ref", conditions=dict(method=["POST"])) mapper.connect("/users/{user_id}/roleRefs/{role_ref_id}", controller=roles_controller, action="delete_role_ref", conditions=dict(method=["DELETE"]))
def __init__(self, options): self.options = options mapper = routes.Mapper() db.configure_backends(options) # Token Operations auth_controller = AuthController(options) mapper.connect("/tokens", controller=auth_controller, action="authenticate", conditions=dict(method=["POST"])) mapper.connect("/tokens/{token_id}", controller=auth_controller, action="validate_token", conditions=dict(method=["GET"])) mapper.connect("/tokens/{token_id}", controller=auth_controller, action="check_token", conditions=dict(method=["HEAD"])) # Do we need this.API doesn't have delete token. mapper.connect("/tokens/{token_id}", controller=auth_controller, action="delete_token", conditions=dict(method=["DELETE"])) mapper.connect("/tokens/{token_id}/endpoints", controller=auth_controller, action="endpoints", conditions=dict(method=["GET"])) # Tenant Operations tenant_controller = TenantController(options) mapper.connect("/tenants", controller=tenant_controller, action="get_tenants", conditions=dict(method=["GET"])) mapper.connect("/tenants/{tenant_id}", controller=tenant_controller, action="get_tenant", conditions=dict(method=["GET"])) roles_controller = RolesController(options) mapper.connect("/tenants/{tenant_id}/users/{user_id}/roles", controller=roles_controller, action="get_user_roles", conditions=dict(method=["GET"])) # User Operations user_controller = UserController(options) mapper.connect("/users/{user_id}", controller=user_controller, action="get_user", conditions=dict(method=["GET"])) mapper.connect("/users/{user_id}/roles", controller=roles_controller, action="get_user_roles", conditions=dict(method=["GET"])) # Miscellaneous Operations version_controller = VersionController(options) mapper.connect("/", controller=version_controller, action="get_version_info", file="admin/version", conditions=dict(method=["GET"])) extensions_controller = ExtensionsController(options) mapper.connect("/extensions", controller=extensions_controller, action="get_extensions_info", path="content/admin/extensions", conditions=dict(method=["GET"])) # Static Files Controller static_files_controller = StaticFilesController(options) mapper.connect("/identityadminguide.pdf", controller=static_files_controller, action="get_pdf_contract", root="content/admin/", pdf="identityadminguide.pdf", conditions=dict(method=["GET"])) mapper.connect("/identity-admin.wadl", controller=static_files_controller, action="get_wadl_contract", root="content/admin/", wadl="identity-admin.wadl", conditions=dict(method=["GET"])) mapper.connect("/common.ent", controller=static_files_controller, action="get_wadl_contract", root="content/common/", wadl="common.ent", conditions=dict(method=["GET"])) mapper.connect("/xsd/{xsd}", controller=static_files_controller, action="get_xsd_contract", root="content/common/", conditions=dict(method=["GET"])) mapper.connect("/xsd/atom/{xsd}", controller=static_files_controller, action="get_xsd_atom_contract", root="content/common/", conditions=dict(method=["GET"])) mapper.connect("/xslt/{file:.*}", controller=static_files_controller, action="get_static_file", root="content/common/", path="xslt/", mimetype="application/xml", conditions=dict(method=["GET"])) mapper.connect("/js/{file:.*}", controller=static_files_controller, action="get_static_file", root="content/common/", path="js/", mimetype="application/javascript", conditions=dict(method=["GET"])) mapper.connect("/style/{file:.*}", controller=static_files_controller, action="get_static_file", root="content/common/", path="style/", mimetype="application/css", conditions=dict(method=["GET"])) mapper.connect("/samples/{file:.*}", controller=static_files_controller, action="get_static_file", root="content/common/", path="samples/", conditions=dict(method=["GET"])) extension.configure_extensions(mapper, options) super(AdminApi, self).__init__(mapper)
def map_extension_methods(self, mapper, options): tenant_controller = TenantController(options) roles_controller = RolesController(options) user_controller = UserController(options) credentials_controller = CredentialsController(options) # Tenant Operations mapper.connect("/tenants", controller=tenant_controller, action="create_tenant", conditions=dict(method=["POST"])) mapper.connect("/tenants/{tenant_id}", controller=tenant_controller, action="update_tenant", conditions=dict(method=["POST"])) mapper.connect("/tenants/{tenant_id}", controller=tenant_controller, action="delete_tenant", conditions=dict(method=["DELETE"])) mapper.connect("/tenants/{tenant_id}/users", controller=user_controller, action="get_tenant_users", conditions=dict(method=["GET"])) #Add/Delete Tenant specific role. mapper.connect( "/tenants/{tenant_id}/users/{user_id}/roles/OS-KSADM/{role_id}", controller=roles_controller, action="add_role_to_user", conditions=dict(method=["PUT"])) mapper.connect( "/tenants/{tenant_id}/users/{user_id}/roles/OS-KSADM/{role_id}", controller=roles_controller, action="delete_role_from_user", conditions=dict(method=["DELETE"])) # User Operations mapper.connect("/users", controller=user_controller, action="get_users", conditions=dict(method=["GET"])) mapper.connect("/users", controller=user_controller, action="create_user", conditions=dict(method=["POST"])) mapper.connect("/users/{user_id}", controller=user_controller, action="update_user", conditions=dict(method=["POST"])) mapper.connect("/users/{user_id}", controller=user_controller, action="delete_user", conditions=dict(method=["DELETE"])) #API doesn't have any of the shorthand updates as of now. mapper.connect("/users/{user_id}/OS-KSADM/password", controller=user_controller, action="set_user_password", conditions=dict(method=["PUT"])) mapper.connect("/users/{user_id}/OS-KSADM/tenant", controller=user_controller, action="update_user_tenant", conditions=dict(method=["PUT"])) # Test this, test failed mapper.connect("/users/{user_id}/OS-KSADM/enabled", controller=user_controller, action="set_user_enabled", conditions=dict(method=["PUT"])) #User Roles #Add/Delete Global role. mapper.connect("/users/{user_id}/roles/OS-KSADM/{role_id}", controller=roles_controller, action="add_role_to_user", conditions=dict(method=["PUT"])) mapper.connect("/users/{user_id}/roles/OS-KSADM/{role_id}", controller=roles_controller, action="delete_role_from_user", conditions=dict(method=["DELETE"])) # Services Operations services_controller = ServicesController(options) mapper.connect("/OS-KSADM/services", controller=services_controller, action="get_services", conditions=dict(method=["GET"])) mapper.connect("/OS-KSADM/services", controller=services_controller, action="create_service", conditions=dict(method=["POST"])) mapper.connect("/OS-KSADM/services/{service_id}", controller=services_controller, action="delete_service", conditions=dict(method=["DELETE"])) mapper.connect("/OS-KSADM/services/{service_id}", controller=services_controller, action="get_service", conditions=dict(method=["GET"])) #Roles Operations mapper.connect("/OS-KSADM/roles", controller=roles_controller, action="create_role", conditions=dict(method=["POST"])) mapper.connect("/OS-KSADM/roles", controller=roles_controller, action="get_roles", conditions=dict(method=["GET"])) mapper.connect("/OS-KSADM/roles/{role_id}", controller=roles_controller, action="get_role", conditions=dict(method=["GET"])) mapper.connect("/OS-KSADM/roles/{role_id}", controller=roles_controller, action="delete_role", conditions=dict(method=["DELETE"])) #Credentials Operations mapper.connect("/users/{user_id}/OS-KSADM/credentials", controller=credentials_controller, action="get_credentials", conditions=dict(method=["GET"])) mapper.connect("/users/{user_id}/OS-KSADM/credentials", controller=credentials_controller, action="add_credential", conditions=dict(method=["POST"])) mapper.connect("/users/{user_id}/OS-KSADM/"\ "credentials/passwordCredentials", controller=credentials_controller, action="get_password_credential", conditions=dict(method=["GET"])) mapper.connect("/users/{user_id}/OS-KSADM/credentials"\ "/passwordCredentials", controller=credentials_controller, action="update_password_credential", conditions=dict(method=["POST"])) mapper.connect("/users/{user_id}/"\ "OS-KSADM/credentials/passwordCredentials", controller=credentials_controller, action="delete_password_credential", conditions=dict(method=["DELETE"]))