示例#1
0
def includeme(config):
    LOGGER.info("Adding API resource...")
    # Add all the rest api routes
    config.add_route(**s.service_api_route_info(s.ResourcesAPI))
    config.add_route(**s.service_api_route_info(s.ResourceAPI))
    config.add_route(**s.service_api_route_info(s.ResourcePermissionsAPI))

    config.scan()
示例#2
0
def includeme(config):
    from magpie.api import schemas as s
    LOGGER.info("Adding api login...")
    # Add all the rest api routes
    config.add_route(**s.service_api_route_info(s.SessionAPI))
    config.add_route(**s.service_api_route_info(s.SigninAPI))
    config.add_route(**s.service_api_route_info(s.ProvidersAPI))
    config.add_route(**s.service_api_route_info(s.ProviderSigninAPI))
    config.scan()
示例#3
0
def includeme(config):
    LOGGER.info("Adding swagger...")
    config.add_route(**s.service_api_route_info(s.SwaggerAPI))
    config.add_route(**s.service_api_route_info(s.SwaggerGenerator))
    config.add_view(s.api_schema,
                    route_name=s.SwaggerGenerator.name,
                    request_method="GET",
                    renderer="json",
                    permission=NO_PERMISSION_REQUIRED)
    config.add_view(api_swagger,
                    route_name=s.SwaggerAPI.name,
                    renderer="templates/swagger_ui.mako",
                    permission=NO_PERMISSION_REQUIRED)
示例#4
0
def includeme(config):
    LOGGER.info("Adding API base routes...")
    config.add_route(**s.service_api_route_info(s.VersionAPI))
    if not get_constant("MAGPIE_UI_ENABLED"):
        LOGGER.info("Adding API homepage...")
        config.add_route(s.HomepageAPI.name, s.HomepageAPI.path)
        config.add_view(get_homepage, route_name=s.HomepageAPI.name, permission=NO_PERMISSION_REQUIRED)
    config.scan()
示例#5
0
def includeme(config):
    LOGGER.info('Adding api service...')
    # NOTE:
    #   routes 'by type' must be before 'by name' to be evaluated first
    #   order is important to preserve expected behaviour,
    #   otherwise service named 'types' is searched before
    # --- service by type ---
    config.add_route(**s.service_api_route_info(s.ServiceTypesAPI))
    config.add_route(**s.service_api_route_info(s.ServiceTypeAPI))
    config.add_route(**s.service_api_route_info(s.ServiceTypeResourcesAPI))
    config.add_route(**s.service_api_route_info(s.ServiceTypeResourceTypesAPI))
    # --- service by name ---
    config.add_route(**s.service_api_route_info(s.ServicesAPI))
    config.add_route(**s.service_api_route_info(s.ServiceAPI))
    config.add_route(**s.service_api_route_info(s.ServicePermissionsAPI))
    config.add_route(**s.service_api_route_info(s.ServiceResourcesAPI))
    config.add_route(**s.service_api_route_info(s.ServiceResourceAPI))
    config.scan()
示例#6
0
def includeme(config):
    LOGGER.info("Adding API user...")

    # note: routes that require user 'self' operations must add the following, otherwise default RootFactory is used
    user_kwargs = {"factory": UserFactory, "traverse": "/{user_name}"}

    # Add user variable routes
    config.add_route(**s.service_api_route_info(
        s.UsersAPI))  # no user instance, admin-only
    config.add_route(**s.service_api_route_info(s.UserAPI, **user_kwargs))
    config.add_route(
        **s.service_api_route_info(s.UserGroupsAPI, **user_kwargs))
    config.add_route(**s.service_api_route_info(s.UserGroupAPI, **user_kwargs))
    config.add_route(
        **s.service_api_route_info(s.UserServicesAPI, **user_kwargs))
    config.add_route(
        **s.service_api_route_info(s.UserServicePermissionsAPI, **user_kwargs))
    config.add_route(
        **s.service_api_route_info(s.UserServicePermissionAPI, **user_kwargs))
    config.add_route(
        **s.service_api_route_info(s.UserServiceResourcesAPI, **user_kwargs))
    config.add_route(
        **s.service_api_route_info(s.UserResourcesAPI, **user_kwargs))
    config.add_route(
        **s.service_api_route_info(s.UserResourceTypesAPI, **user_kwargs))
    config.add_route(**s.service_api_route_info(s.UserResourcePermissionsAPI,
                                                **user_kwargs))
    config.add_route(
        **s.service_api_route_info(s.UserResourcePermissionAPI, **user_kwargs))
    # Logged User routes
    config.add_route(
        **s.service_api_route_info(s.LoggedUserAPI, **user_kwargs))
    config.add_route(
        **s.service_api_route_info(s.LoggedUserGroupsAPI, **user_kwargs))
    config.add_route(
        **s.service_api_route_info(s.LoggedUserGroupAPI, **user_kwargs))
    config.add_route(
        **s.service_api_route_info(s.LoggedUserServicesAPI, **user_kwargs))
    config.add_route(**s.service_api_route_info(
        s.LoggedUserServicePermissionsAPI, **user_kwargs))
    config.add_route(**s.service_api_route_info(
        s.LoggedUserServicePermissionAPI, **user_kwargs))
    config.add_route(**s.service_api_route_info(
        s.LoggedUserServiceResourcesAPI, **user_kwargs))
    config.add_route(
        **s.service_api_route_info(s.LoggedUserResourcesAPI, **user_kwargs))
    config.add_route(**s.service_api_route_info(s.LoggedUserResourceTypesAPI,
                                                **user_kwargs))
    config.add_route(**s.service_api_route_info(
        s.LoggedUserResourcePermissionsAPI, **user_kwargs))
    config.add_route(**s.service_api_route_info(
        s.LoggedUserResourcePermissionAPI, **user_kwargs))

    config.scan()
示例#7
0
def includeme(config):
    LOGGER.info("Adding api group...")
    # Add all the rest api routes
    config.add_route(**s.service_api_route_info(s.GroupsAPI))
    config.add_route(**s.service_api_route_info(s.GroupAPI))
    config.add_route(**s.service_api_route_info(s.GroupUsersAPI))
    config.add_route(**s.service_api_route_info(s.GroupServicesAPI))
    config.add_route(**s.service_api_route_info(s.GroupServicePermissionsAPI))
    config.add_route(**s.service_api_route_info(s.GroupServicePermissionAPI))
    config.add_route(**s.service_api_route_info(s.GroupServiceResourcesAPI))
    config.add_route(**s.service_api_route_info(s.GroupResourcesAPI))
    config.add_route(**s.service_api_route_info(s.GroupResourcePermissionsAPI))
    config.add_route(**s.service_api_route_info(s.GroupResourcePermissionAPI))
    config.add_route(**s.service_api_route_info(s.GroupResourceTypesAPI))

    config.scan()
示例#8
0
def includeme(config):
    LOGGER.info('Adding api user...')
    # Add all the rest api routes
    config.add_route(**s.service_api_route_info(s.UsersAPI))
    config.add_route(**s.service_api_route_info(s.UserAPI))
    config.add_route(**s.service_api_route_info(s.UserGroupsAPI))
    config.add_route(**s.service_api_route_info(s.UserGroupAPI))
    config.add_route(**s.service_api_route_info(s.UserServicesAPI))
    config.add_route(**s.service_api_route_info(s.UserInheritedServicesAPI))
    config.add_route(**s.service_api_route_info(s.UserServicePermissionsAPI))
    config.add_route(**s.service_api_route_info(s.UserServicePermissionAPI))
    config.add_route(
        **s.service_api_route_info(s.UserServiceInheritedPermissionsAPI))
    config.add_route(**s.service_api_route_info(s.UserServiceResourcesAPI))
    config.add_route(
        **s.service_api_route_info(s.UserServiceInheritedResourcesAPI))
    config.add_route(**s.service_api_route_info(s.UserResourcesAPI))
    config.add_route(**s.service_api_route_info(s.UserInheritedResourcesAPI))
    config.add_route(**s.service_api_route_info(s.UserResourceTypesAPI))
    config.add_route(**s.service_api_route_info(s.UserResourcePermissionsAPI))
    config.add_route(**s.service_api_route_info(s.UserResourcePermissionAPI))
    config.add_route(
        **s.service_api_route_info(s.UserResourceInheritedPermissionsAPI))
    # Logged User routes
    config.add_route(**s.service_api_route_info(s.LoggedUserAPI))
    config.add_route(**s.service_api_route_info(s.LoggedUserGroupsAPI))
    config.add_route(**s.service_api_route_info(s.LoggedUserGroupAPI))
    config.add_route(**s.service_api_route_info(s.LoggedUserServicesAPI))
    config.add_route(
        **s.service_api_route_info(s.LoggedUserInheritedServicesAPI))
    config.add_route(
        **s.service_api_route_info(s.LoggedUserServicePermissionsAPI))
    config.add_route(
        **s.service_api_route_info(s.LoggedUserServicePermissionAPI))
    config.add_route(
        **s.service_api_route_info(s.LoggedUserServiceInheritedPermissionsAPI))
    config.add_route(
        **s.service_api_route_info(s.LoggedUserServiceResourcesAPI))
    config.add_route(
        **s.service_api_route_info(s.LoggedUserServiceInheritedResourcesAPI))
    config.add_route(**s.service_api_route_info(s.LoggedUserResourcesAPI))
    config.add_route(
        **s.service_api_route_info(s.LoggedUserInheritedResourcesAPI))
    config.add_route(**s.service_api_route_info(s.LoggedUserResourceTypesAPI))
    config.add_route(
        **s.service_api_route_info(s.LoggedUserResourcePermissionsAPI))
    config.add_route(
        **s.service_api_route_info(s.LoggedUserResourcePermissionAPI))
    config.add_route(**s.service_api_route_info(
        s.LoggedUserResourceInheritedPermissionsAPI))

    config.scan()