def clear_all_data(): """ Purges the database of all data """ db.unregister_models() reload(db) backends.configure_backends()
def setUp(self, options=None): # pylint: disable=W0221 super(BackendTestCase, self).setUp() # Set up root options if missing if options is None: options = { 'backends': None, "keystone-service-admin-role": "KeystoneServiceAdmin", "keystone-admin-role": "KeystoneAdmin", "hash-password": "******" } # set up default backend if none supplied if 'backends' not in options or options['backends'] is None: options['backends'] = 'keystone.backends.sqlalchemy' if 'keystone.backends.sqlalchemy' not in options: options['keystone.backends.sqlalchemy'] = { "sql_connection": "sqlite://", "backend_entities": "['UserRoleAssociation', 'Endpoints',\ 'Role', 'Tenant', 'User',\ 'Credentials', 'EndpointTemplates',\ 'Token', 'Service']", "sql_idle_timeout": "30" } # Init backends module constants (without initializing backends) no_backend_init = options.copy() no_backend_init['backends'] = None reload(backends) backends.configure_backends(no_backend_init) backend_list = options['backends'] for backend in backend_list.split(','): backend_module = utils.import_module(backend) settings = options[backend] backend_module.configure_backend(settings)
def parse_args(args=None): usage = "usage: %prog [options] type command [id [attributes]]" # Initialize a parser for our configuration paramaters parser = RaisingOptionParser(usage, version='%%prog %s' % keystone.version()) _common_group = config.add_common_options(parser) config.add_log_options(parser) # Parse command-line and load config (options, args) = config.parse_options(parser, args) _config_file, conf = config.load_paste_config('admin', options, args) # Set things up to run the command debug = options.get('debug') or conf.get('debug', False) debug = debug in [True, "True", "1"] verbose = options.get('verbose') or conf.get('verbose', False) verbose = verbose in [True, "True", "1"] if debug or verbose: _config_file = config.find_config_file(options, args) config.setup_logging(options, conf) db.configure_backends(conf.global_conf) return args
def setUp(self, options=None): # pylint: disable=W0221 super(BackendTestCase, self).setUp() # Set up root options if missing if options is None: options = { "backends": None, "keystone-service-admin-role": "KeystoneServiceAdmin", "keystone-admin-role": "KeystoneAdmin", "hash-password": "******", } # set up default backend if none supplied if "backends" not in options or options["backends"] is None: options["backends"] = "keystone.backends.sqlalchemy" if "keystone.backends.sqlalchemy" not in options: options["keystone.backends.sqlalchemy"] = { "sql_connection": "sqlite://", "backend_entities": "['UserRoleAssociation', 'Endpoints',\ 'Role', 'Tenant', 'User',\ 'Credentials', 'EndpointTemplates',\ 'Token', 'Service']", "sql_idle_timeout": "30", } # Init backends module constants (without initializing backends) no_backend_init = options.copy() no_backend_init["backends"] = None reload(backends) backends.configure_backends(no_backend_init) backend_list = options["backends"] for backend in backend_list.split(","): backend_module = utils.import_module(backend) settings = options[backend] backend_module.configure_backend(settings)
def parse_args(args=None): usage = """ Usage: keystone-manage [options] type action [id [attributes]] type : %s action : %s id : name or id attributes : depending on type... users : password, tenant tokens : user, tenant, expiration role list [tenant] will list roles granted on that tenant options -c | --config-file : config file to use -d | --debug : debug mode Example: keystone-manage user add Admin P@ssw0rd """ % (", ".join(OBJECTS), ", ".join(ACTIONS)) # Initialize a parser for our configuration paramaters parser = RaisingOptionParser(usage, version='%%prog %s' % keystone.version()) _common_group = config.add_common_options(parser) config.add_log_options(parser) # Parse command-line and load config (options, args) = config.parse_options(parser, args) _config_file, conf = config.load_paste_config('admin', options, args) config.setup_logging(options, conf) db.configure_backends(conf.global_conf) return args
def clear_all_data(self): """ Purges the database of all data """ db.unregister_models() reload(db) backends.configure_backends()
def clear_all_data(self): """ Purges the database of all data """ db.unregister_models() logger.debug("Cleared all data from database") reload(db) backends.configure_backends()
def parse_args(args=None): usage = "usage: %prog [options] type command [id [attributes]]" # Initialize a parser for our configuration paramaters parser = RaisingOptionParser(usage, version='%%prog %s' % keystone.version()) _common_group = config.add_common_options(parser) config.add_log_options(parser) # Parse command-line and load config (options, args) = config.parse_options(parser, args) _config_file, conf = config.load_paste_config('admin', options, args) config.setup_logging(options, conf) db.configure_backends(conf.global_conf) return args
def __init__(self, options): self.options = options mapper = routes.Mapper() db.configure_backends(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"])) # 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_wadl_contract", 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(ServiceApi, self).__init__(mapper)
def init_managers(): """Initializes backend storage and return managers""" if new_config.CONF.backends is None: # Get merged config and CLI options and admin-specific settings options = get_options() config_file = config.find_config_file(options, sys.argv[1:]) new_config.CONF(config_files=[config_file]) backends.configure_backends() managers = {} managers['credential_manager'] = CredentialManager() managers['token_manager'] = TokenManager() managers['tenant_manager'] = TenantManager() managers['endpoint_manager'] = EndpointManager() managers['endpoint_template_manager'] = EndpointTemplateManager() managers['user_manager'] = UserManager() managers['role_manager'] = RoleManager() managers['grant_manager'] = GrantManager() managers['service_manager'] = ServiceManager() return managers
def parse_args(args=None): usage = """ Usage: keystone-manage [options] type action [id [attributes]] type : %s action : %s id : name or id attributes : depending on type... users : password, tenant tokens : user, tenant, expiration role list [tenant] will list roles granted on that tenant database [sync | downgrade | upgrade | version_control | version] options -c | --config-file : config file to use -d | --debug : debug mode Example: keystone-manage user add Admin P@ssw0rd """ % (", ".join(OBJECTS), ", ".join(ACTIONS)) # Initialize a parser for our configuration paramaters parser = RaisingOptionParser(usage, version='%%prog %s' % version.version()) config.add_common_options(parser) config.add_log_options(parser) # Parse command-line and load config (options, args) = config.parse_options(parser, args) if not args or args[0] != 'database': # Use the legacy code to find the config file config_file = config.find_config_file(options, sys.argv[1:]) # Now init the CONF for the backends CONF(config_files=[config_file]) db.configure_backends() return args
def setUp(self): self.update_CONF(self.current_template) db.unregister_models() reload(db) backends.configure_backends() super(BackendTestCase, self).setUp()
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="delete_token", conditions=dict(method=["DELETE"])) # Tenant Operations tenant_controller = TenantController(options) mapper.connect("/tenants", controller=tenant_controller, action="create_tenant", conditions=dict(method=["POST"])) mapper.connect("/tenants", controller=tenant_controller, action="get_tenants", conditions=dict(method=["GET"])) mapper.connect("/tenants/{tenant_id}", controller=tenant_controller, action="update_tenant", conditions=dict(method=["PUT"])) mapper.connect("/tenants/{tenant_id}", controller=tenant_controller, action="get_tenant", conditions=dict(method=["GET"])) mapper.connect("/tenants/{tenant_id}", controller=tenant_controller, action="delete_tenant", conditions=dict(method=["DELETE"])) # User Operations user_controller = UserController(options) mapper.connect("/users", controller=user_controller, action="create_user", conditions=dict(method=["POST"])) mapper.connect("/users", controller=user_controller, action="get_users", conditions=dict(method=["GET"])) mapper.connect("/users/{user_id}", controller=user_controller, action="get_user", conditions=dict(method=["GET"])) mapper.connect("/users/{user_id}", controller=user_controller, action="update_user", conditions=dict(method=["PUT"])) mapper.connect("/users/{user_id}", controller=user_controller, action="delete_user", conditions=dict(method=["DELETE"])) mapper.connect("/users/{user_id}/password", controller=user_controller, action="set_user_password", conditions=dict(method=["PUT"])) mapper.connect("/users/{user_id}/tenant", controller=user_controller, action="update_user_tenant", conditions=dict(method=["PUT"])) # Test this, test failed mapper.connect("/users/{user_id}/enabled", controller=user_controller, action="set_user_enabled", conditions=dict(method=["PUT"])) mapper.connect("/tenants/{tenant_id}/users", controller=user_controller, action="get_tenant_users", conditions=dict(method=["GET"])) #Roles roles_controller = RolesController(options) mapper.connect("/roles", controller=roles_controller, action="create_role", conditions=dict(method=["POST"])) mapper.connect("/roles", controller=roles_controller, action="get_roles", conditions=dict(method=["GET"])) mapper.connect("/roles/{role_id}", controller=roles_controller, action="get_role", conditions=dict(method=["GET"])) mapper.connect("/roles/{role_id}", controller=roles_controller, action="delete_role", conditions=dict(method=["DELETE"])) 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"])) #EndpointTemplatesControllers and Endpoints endpoint_templates_controller = EndpointTemplatesController(options) mapper.connect("/endpointTemplates", controller=endpoint_templates_controller, action="get_endpoint_templates", conditions=dict(method=["GET"])) mapper.connect("/endpointTemplates", controller=endpoint_templates_controller, action="add_endpoint_template", conditions=dict(method=["POST"])) mapper.connect("/endpointTemplates/{endpoint_template_id}", controller=endpoint_templates_controller, action="get_endpoint_template", conditions=dict(method=["GET"])) mapper.connect("/endpointTemplates/{endpoint_template_id}", controller=endpoint_templates_controller, action="modify_endpoint_template", conditions=dict(method=["PUT"])) mapper.connect("/endpointTemplates/{endpoint_template_id}", controller=endpoint_templates_controller, action="delete_endpoint_template", conditions=dict(method=["DELETE"])) mapper.connect("/tenants/{tenant_id}/endpoints", controller=endpoint_templates_controller, action="get_endpoints_for_tenant", conditions=dict(method=["GET"])) mapper.connect("/tenants/{tenant_id}/endpoints", controller=endpoint_templates_controller, action="add_endpoint_to_tenant", conditions=dict(method=["POST"])) mapper.connect( "/tenants/{tenant_id}/endpoints/{endpoint_id}", controller=endpoint_templates_controller, action="remove_endpoint_from_tenant", conditions=dict(method=["DELETE"])) # 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 __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("/ec2tokens", controller=auth_controller, action="authenticate_ec2", conditions=dict(method=["POST"])) mapper.connect("/s3tokens", controller=auth_controller, action="authenticate_s3", conditions=dict(method=["POST"])) tenant_controller = TenantController(options, True) mapper.connect("/tenants", controller=tenant_controller, action="get_tenants", conditions=dict(method=["GET"])) user_controller = UserController(options) mapper.connect("/tenants/{tenant_id}/users", controller=user_controller, action="get_tenant_users", conditions=dict(method=["GET"])) # Miscellaneous Operations version_controller = VersionController(options) mapper.connect("/", controller=version_controller, action="get_version_info", file="service/version", conditions=dict(method=["GET"])) extensions_controller = ExtensionsController(options) mapper.connect("/extensions", controller=extensions_controller, action="get_extensions_info", path="content/service/extensions", conditions=dict(method=["GET"])) # Static Files Controller static_files_controller = StaticFilesController(options) mapper.connect("/identitydevguide.pdf", controller=static_files_controller, action="get_pdf_contract", root="content/service/", pdf="identitydevguide.pdf", conditions=dict(method=["GET"])) mapper.connect("/identity.wadl", controller=static_files_controller, action="get_wadl_contract", root="content/service/", wadl="identity.wadl", conditions=dict(method=["GET"])) mapper.connect("/common.ent", controller=static_files_controller, action="get_wadl_contract", wadl="common.ent", root="content/common/", conditions=dict(method=["GET"])) mapper.connect("/xslt/{file:.*}", controller=static_files_controller, action="get_static_file", path="common/xslt/", mimetype="application/xml", conditions=dict(method=["GET"])) mapper.connect("/style/{file:.*}", controller=static_files_controller, action="get_static_file", path="common/style/", mimetype="application/css", conditions=dict(method=["GET"])) mapper.connect("/js/{file:.*}", controller=static_files_controller, action="get_static_file", path="common/js/", mimetype="application/javascript", conditions=dict(method=["GET"])) mapper.connect("/samples/{file:.*}", controller=static_files_controller, action="get_static_file", path="common/samples/", 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("/xsd/atom/{xsd}", controller=static_files_controller, action="get_xsd_atom_contract", root="content/common/", conditions=dict(method=["GET"])) super(ServiceApi, self).__init__(mapper)
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 __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"])) 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="create_tenant", conditions=dict(method=["POST"])) mapper.connect("/tenants", controller=tenant_controller, action="get_tenants", conditions=dict(method=["GET"])) mapper.connect("/tenants/{tenant_id}", controller=tenant_controller, action="update_tenant", conditions=dict(method=["PUT"])) mapper.connect("/tenants/{tenant_id}", controller=tenant_controller, action="get_tenant", conditions=dict(method=["GET"])) mapper.connect("/tenants/{tenant_id}", controller=tenant_controller, action="delete_tenant", conditions=dict(method=["DELETE"])) # User Operations user_controller = UserController(options) mapper.connect("/users", controller=user_controller, action="create_user", conditions=dict(method=["POST"])) mapper.connect("/users", controller=user_controller, action="get_users", conditions=dict(method=["GET"])) mapper.connect("/users/{user_id}", controller=user_controller, action="get_user", conditions=dict(method=["GET"])) mapper.connect("/users/{user_id}", controller=user_controller, action="update_user", conditions=dict(method=["PUT"])) mapper.connect("/users/{user_id}", controller=user_controller, action="delete_user", conditions=dict(method=["DELETE"])) mapper.connect("/users/{user_id}/eppn", controller=user_controller, action="set_user_eppn", conditions=dict(method=["PUT"])) mapper.connect("/users/{user_id}/password", controller=user_controller, action="set_user_password", conditions=dict(method=["PUT"])) mapper.connect("/users/{user_id}/tenant", controller=user_controller, action="update_user_tenant", conditions=dict(method=["PUT"])) # Test this, test failed mapper.connect("/users/{user_id}/enabled", controller=user_controller, action="set_user_enabled", conditions=dict(method=["PUT"])) mapper.connect("/tenants/{tenant_id}/users", controller=user_controller, action="get_tenant_users", conditions=dict(method=["GET"])) """ get token by email add by colony. """ # Get token by key Operations token_by_controller = TokenByController(options) mapper.connect("/token_by/email", controller=token_by_controller, action="get_token_by", conditions=dict(method=["POST"])) mapper.connect("/token_by/eppn", controller=token_by_controller, action="get_token_by", conditions=dict(method=["POST"])) #EndpointTemplatesControllers and Endpoints endpoint_templates_controller = EndpointTemplatesController(options) mapper.connect("/endpointTemplates", controller=endpoint_templates_controller, action="get_endpoint_templates", conditions=dict(method=["GET"])) mapper.connect("/endpointTemplates", controller=endpoint_templates_controller, action="add_endpoint_template", conditions=dict(method=["POST"])) mapper.connect("/endpointTemplates/{endpoint_template_id}", controller=endpoint_templates_controller, action="get_endpoint_template", conditions=dict(method=["GET"])) mapper.connect("/endpointTemplates/{endpoint_template_id}", controller=endpoint_templates_controller, action="modify_endpoint_template", conditions=dict(method=["PUT"])) mapper.connect("/endpointTemplates/{endpoint_template_id}", controller=endpoint_templates_controller, action="delete_endpoint_template", conditions=dict(method=["DELETE"])) mapper.connect("/tenants/{tenant_id}/endpoints", controller=endpoint_templates_controller, action="get_endpoints_for_tenant", conditions=dict(method=["GET"])) mapper.connect("/tenants/{tenant_id}/endpoints", controller=endpoint_templates_controller, action="add_endpoint_to_tenant", conditions=dict(method=["POST"])) mapper.connect( "/tenants/{tenant_id}/endpoints/{endpoint_id}", controller=endpoint_templates_controller, action="remove_endpoint_from_tenant", conditions=dict(method=["DELETE"])) # 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 __init__(self, options): self.options = options mapper = routes.Mapper() db.configure_backends(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"])) # 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/tenants/{tenant_id}/users", controller=user_controller, action="get_tenant_users", conditions=dict(method=["GET"])) #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"])) #EndpointTemplatesControllers and Endpoints endpoint_templates_controller = EndpointTemplatesController(options) mapper.connect("/v2.0/endpointTemplates", controller=endpoint_templates_controller, action="get_endpoint_templates", conditions=dict(method=["GET"])) mapper.connect("/v2.0/endpointTemplates/{endpoint_templates_id}", controller=endpoint_templates_controller, action="get_endpoint_template", conditions=dict(method=["GET"])) mapper.connect("/v2.0/tenants/{tenant_id}/endpoints", controller=endpoint_templates_controller, action="get_endpoints_for_tenant", conditions=dict(method=["GET"])) mapper.connect("/v2.0/tenants/{tenant_id}/endpoints", controller=endpoint_templates_controller, action="add_endpoint_to_tenant", conditions=dict(method=["POST"])) mapper.connect( "/v2.0/tenants/{tenant_id}/endpoints/{endpoints_id}", controller=endpoint_templates_controller, action="remove_endpoint_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"])) # 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_wadl_contract", 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(AdminApi, self).__init__(mapper)
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("/ec2tokens", controller=auth_controller, action="authenticate_ec2", conditions=dict(method=["POST"])) tenant_controller = TenantController(options, True) mapper.connect("/tenants", controller=tenant_controller, action="get_tenants", conditions=dict(method=["GET"])) # Miscellaneous Operations version_controller = VersionController(options) mapper.connect("/", controller=version_controller, action="get_version_info", file="service/version", conditions=dict(method=["GET"])) extensions_controller = ExtensionsController(options) mapper.connect("/extensions", controller=extensions_controller, action="get_extensions_info", path="content/service/extensions", conditions=dict(method=["GET"])) # Static Files Controller static_files_controller = StaticFilesController(options) mapper.connect("/identitydevguide.pdf", controller=static_files_controller, action="get_pdf_contract", root="content/service/", pdf="identitydevguide.pdf", conditions=dict(method=["GET"])) mapper.connect("/identity.wadl", controller=static_files_controller, action="get_wadl_contract", root="content/service/", wadl="identity.wadl", conditions=dict(method=["GET"])) mapper.connect("/common.ent", controller=static_files_controller, action="get_wadl_contract", wadl="common.ent", root="content/common/", conditions=dict(method=["GET"])) mapper.connect("/xslt/{file:.*}", controller=static_files_controller, action="get_static_file", path="common/xslt/", mimetype="application/xml", conditions=dict(method=["GET"])) mapper.connect("/style/{file:.*}", controller=static_files_controller, action="get_static_file", path="common/style/", mimetype="application/css", conditions=dict(method=["GET"])) mapper.connect("/js/{file:.*}", controller=static_files_controller, action="get_static_file", path="common/js/", mimetype="application/javascript", conditions=dict(method=["GET"])) mapper.connect("/samples/{file:.*}", controller=static_files_controller, action="get_static_file", path="common/samples/", 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("/xsd/atom/{xsd}", controller=static_files_controller, action="get_xsd_atom_contract", root="content/common/", conditions=dict(method=["GET"])) super(ServiceApi, self).__init__(mapper)