Пример #1
0
    def append_v3_routers(self, mapper, routers):
        user_controller = controllers.UserV3()
        routers.append(router.Router(user_controller, 'users', 'user'))

        self._add_resource(mapper,
                           user_controller,
                           path='/users/{user_id}/password',
                           post_action='change_password')

        self._add_resource(mapper,
                           user_controller,
                           path='/groups/{group_id}/users',
                           get_action='list_users_in_group')

        self._add_resource(mapper,
                           user_controller,
                           path='/groups/{group_id}/users/{user_id}',
                           put_action='add_user_to_group',
                           get_head_action='check_user_in_group',
                           delete_action='remove_user_from_group')

        group_controller = controllers.GroupV3()
        routers.append(router.Router(group_controller, 'groups', 'group'))

        self._add_resource(mapper,
                           group_controller,
                           path='/users/{user_id}/groups',
                           get_action='list_groups_for_user')
Пример #2
0
def append_v3_routers(mapper, routers):
    user_controller = controllers.UserV3()
    routers.append(router.Router(user_controller, 'users', 'user'))
    mapper.connect('/users/{user_id}/password',
                   controller=user_controller,
                   action='change_password',
                   conditions=dict(method=['POST']))

    mapper.connect('/groups/{group_id}/users',
                   controller=user_controller,
                   action='list_users_in_group',
                   conditions=dict(method=['GET']))

    mapper.connect('/groups/{group_id}/users/{user_id}',
                   controller=user_controller,
                   action='add_user_to_group',
                   conditions=dict(method=['PUT']))

    mapper.connect('/groups/{group_id}/users/{user_id}',
                   controller=user_controller,
                   action='check_user_in_group',
                   conditions=dict(method=['HEAD']))

    mapper.connect('/groups/{group_id}/users/{user_id}',
                   controller=user_controller,
                   action='remove_user_from_group',
                   conditions=dict(method=['DELETE']))

    group_controller = controllers.GroupV3()
    routers.append(router.Router(group_controller, 'groups', 'group'))
    mapper.connect('/users/{user_id}/groups',
                   controller=group_controller,
                   action='list_groups_for_user',
                   conditions=dict(method=['GET']))
Пример #3
0
    def append_v3_routers(self, mapper, routers):
        user_controller = controllers.UserV3()
        routers.append(
            router.Router(user_controller,
                          'users',
                          'user',
                          resource_descriptions=self.v3_resources))

        self._add_resource(
            mapper,
            user_controller,
            path='/users/{user_id}/password',
            post_action='change_password',
            rel=json_home.build_v3_resource_relation('user_change_password'),
            path_vars={
                'user_id': json_home.Parameters.USER_ID,
            })

        group_controller = controllers.GroupV3()

        self._add_resource(
            mapper,
            group_controller,
            path='/users/{user_id}/groups',
            get_head_action='list_groups_for_user',
            rel=json_home.build_v3_resource_relation('user_groups'),
            path_vars={
                'user_id': json_home.Parameters.USER_ID,
            })
Пример #4
0
    def append_v3_routers(self, mapper, routers):
        user_controller = controllers.UserV3()
        routers.append(
            router.Router(user_controller,
                          'users',
                          'user',
                          resource_descriptions=self.v3_resources))

        self._add_resource(
            mapper,
            user_controller,
            path='/users/{user_id}/password',
            post_action='change_password',
            rel=json_home.build_v3_resource_relation('user_change_password'),
            path_vars={
                'user_id': json_home.Parameters.USER_ID,
            })

        self._add_resource(
            mapper,
            user_controller,
            path='/groups/{group_id}/users',
            get_head_action='list_users_in_group',
            rel=json_home.build_v3_resource_relation('group_users'),
            path_vars={
                'group_id': json_home.Parameters.GROUP_ID,
            })

        self._add_resource(
            mapper,
            user_controller,
            path='/groups/{group_id}/users/{user_id}',
            put_action='add_user_to_group',
            get_head_action='check_user_in_group',
            delete_action='remove_user_from_group',
            rel=json_home.build_v3_resource_relation('group_user'),
            path_vars={
                'group_id': json_home.Parameters.GROUP_ID,
                'user_id': json_home.Parameters.USER_ID,
            })

        group_controller = controllers.GroupV3()
        routers.append(
            router.Router(group_controller,
                          'groups',
                          'group',
                          resource_descriptions=self.v3_resources))

        self._add_resource(
            mapper,
            group_controller,
            path='/users/{user_id}/groups',
            get_head_action='list_groups_for_user',
            rel=json_home.build_v3_resource_relation('user_groups'),
            path_vars={
                'user_id': json_home.Parameters.USER_ID,
            })
Пример #5
0
def append_v3_routers(mapper, routers):
    routers.append(router.Router(controllers.DomainV3(), 'domains', 'domain'))

    project_controller = controllers.ProjectV3()
    routers.append(router.Router(project_controller, 'projects', 'project'))
    mapper.connect('/users/{user_id}/projects',
                   controller=project_controller,
                   action='list_user_projects',
                   conditions=dict(method=['GET']))

    user_controller = controllers.UserV3()
    routers.append(router.Router(user_controller, 'users', 'user'))
    mapper.connect('/groups/{group_id}/users',
                   controller=user_controller,
                   action='list_users_in_group',
                   conditions=dict(method=['GET']))

    mapper.connect('/groups/{group_id}/users/{user_id}',
                   controller=user_controller,
                   action='add_user_to_group',
                   conditions=dict(method=['PUT']))

    mapper.connect('/groups/{group_id}/users/{user_id}',
                   controller=user_controller,
                   action='check_user_in_group',
                   conditions=dict(method=['HEAD']))

    mapper.connect('/groups/{group_id}/users/{user_id}',
                   controller=user_controller,
                   action='remove_user_from_group',
                   conditions=dict(method=['DELETE']))

    group_controller = controllers.GroupV3()
    routers.append(router.Router(group_controller, 'groups', 'group'))
    mapper.connect('/users/{user_id}/groups',
                   controller=group_controller,
                   action='list_groups_for_user',
                   conditions=dict(method=['GET']))

    role_controller = controllers.RoleV3()
    routers.append(router.Router(role_controller, 'roles', 'role'))
    mapper.connect('/projects/{project_id}/users/{user_id}/roles/{role_id}',
                   controller=role_controller,
                   action='create_grant',
                   conditions=dict(method=['PUT']))
    mapper.connect('/projects/{project_id}/groups/{group_id}/roles/{role_id}',
                   controller=role_controller,
                   action='create_grant',
                   conditions=dict(method=['PUT']))
    mapper.connect('/projects/{project_id}/users/{user_id}/roles/{role_id}',
                   controller=role_controller,
                   action='check_grant',
                   conditions=dict(method=['HEAD']))
    mapper.connect('/projects/{project_id}/groups/{group_id}/roles/{role_id}',
                   controller=role_controller,
                   action='check_grant',
                   conditions=dict(method=['HEAD']))
    mapper.connect('/projects/{project_id}/users/{user_id}/roles',
                   controller=role_controller,
                   action='list_grants',
                   conditions=dict(method=['GET']))
    mapper.connect('/projects/{project_id}/groups/{group_id}/roles',
                   controller=role_controller,
                   action='list_grants',
                   conditions=dict(method=['GET']))
    mapper.connect('/projects/{project_id}/users/{user_id}/roles/{role_id}',
                   controller=role_controller,
                   action='revoke_grant',
                   conditions=dict(method=['DELETE']))
    mapper.connect('/projects/{project_id}/groups/{group_id}/roles/{role_id}',
                   controller=role_controller,
                   action='revoke_grant',
                   conditions=dict(method=['DELETE']))
    mapper.connect('/domains/{domain_id}/users/{user_id}/roles/{role_id}',
                   controller=role_controller,
                   action='create_grant',
                   conditions=dict(method=['PUT']))
    mapper.connect('/domains/{domain_id}/groups/{group_id}/roles/{role_id}',
                   controller=role_controller,
                   action='create_grant',
                   conditions=dict(method=['PUT']))
    mapper.connect('/domains/{domain_id}/users/{user_id}/roles/{role_id}',
                   controller=role_controller,
                   action='check_grant',
                   conditions=dict(method=['HEAD']))
    mapper.connect('/domains/{domain_id}/groups/{group_id}/roles/{role_id}',
                   controller=role_controller,
                   action='check_grant',
                   conditions=dict(method=['HEAD']))
    mapper.connect('/domains/{domain_id}/users/{user_id}/roles',
                   controller=role_controller,
                   action='list_grants',
                   conditions=dict(method=['GET']))
    mapper.connect('/domains/{domain_id}/groups/{group_id}/roles',
                   controller=role_controller,
                   action='list_grants',
                   conditions=dict(method=['GET']))
    mapper.connect('/domains/{domain_id}/users/{user_id}/roles/{role_id}',
                   controller=role_controller,
                   action='revoke_grant',
                   conditions=dict(method=['DELETE']))
    mapper.connect('/domains/{domain_id}/groups/{group_id}/roles/{role_id}',
                   controller=role_controller,
                   action='revoke_grant',
                   conditions=dict(method=['DELETE']))

    if config.CONF.os_inherit.enabled:
        mapper.connect(('/OS-INHERIT/domains/{domain_id}/users/{user_id}'
                        '/roles/{role_id}/inherited_to_projects'),
                       controller=role_controller,
                       action='create_grant',
                       conditions=dict(method=['PUT']))
        mapper.connect(('/OS-INHERIT/domains/{domain_id}/groups/{group_id}'
                        '/roles/{role_id}/inherited_to_projects'),
                       controller=role_controller,
                       action='create_grant',
                       conditions=dict(method=['PUT']))
        mapper.connect(('/OS-INHERIT/domains/{domain_id}/users/{user_id}'
                        '/roles/{role_id}/inherited_to_projects'),
                       controller=role_controller,
                       action='check_grant',
                       conditions=dict(method=['HEAD']))
        mapper.connect(('/OS-INHERIT/domains/{domain_id}/groups/{group_id}'
                        '/roles/{role_id}/inherited_to_projects'),
                       controller=role_controller,
                       action='check_grant',
                       conditions=dict(method=['HEAD']))
        mapper.connect(('/OS-INHERIT/domains/{domain_id}/users/{user_id}'
                        '/roles/inherited_to_projects'),
                       controller=role_controller,
                       action='list_grants',
                       conditions=dict(method=['GET']))
        mapper.connect(('/OS-INHERIT/domains/{domain_id}/groups/{group_id}'
                        '/roles/inherited_to_projects'),
                       controller=role_controller,
                       action='list_grants',
                       conditions=dict(method=['GET']))
        mapper.connect(('/OS-INHERIT/domains/{domain_id}/users/{user_id}'
                        '/roles/{role_id}/inherited_to_projects'),
                       controller=role_controller,
                       action='revoke_grant',
                       conditions=dict(method=['DELETE']))
        mapper.connect(('/OS-INHERIT/domains/{domain_id}/groups/{group_id}'
                        '/roles/{role_id}/inherited_to_projects'),
                       controller=role_controller,
                       action='revoke_grant',
                       conditions=dict(method=['DELETE']))
    routers.append(
        router.Router(controllers.RoleAssignmentV3(), 'role_assignments',
                      'role_assignment'))
Пример #6
0
def append_v3_routers(mapper, routers):
    routers.append(router.Router(controllers.DomainV3(), 'domains', 'domain'))

    project_controller = controllers.ProjectV3()
    routers.append(router.Router(project_controller, 'projects', 'project'))
    mapper.connect('/users/{user_id}/projects',
                   controller=project_controller,
                   action='list_user_projects',
                   conditions=dict(method=['GET']))

    user_controller = controllers.UserV3()
    routers.append(router.Router(user_controller, 'users', 'user'))
    mapper.connect('/groups/{group_id}/users',
                   controller=user_controller,
                   action='list_users_in_group',
                   conditions=dict(method=['GET']))

    mapper.connect('/groups/{group_id}/users/{user_id}',
                   controller=user_controller,
                   action='add_user_to_group',
                   conditions=dict(method=['PUT']))

    mapper.connect('/groups/{group_id}/users/{user_id}',
                   controller=user_controller,
                   action='check_user_in_group',
                   conditions=dict(method=['HEAD']))

    mapper.connect('/groups/{group_id}/users/{user_id}',
                   controller=user_controller,
                   action='remove_user_from_group',
                   conditions=dict(method=['DELETE']))

    group_controller = controllers.GroupV3()
    routers.append(router.Router(group_controller, 'groups', 'group'))
    mapper.connect('/users/{user_id}/groups',
                   controller=group_controller,
                   action='list_groups_for_user',
                   conditions=dict(method=['GET']))

    routers.append(
        router.Router(controllers.CredentialV3(), 'credentials', 'credential'))

    role_controller = controllers.RoleV3()
    routers.append(router.Router(role_controller, 'roles', 'role'))
    mapper.connect('/projects/{project_id}/users/{user_id}/roles/{role_id}',
                   controller=role_controller,
                   action='create_grant',
                   conditions=dict(method=['PUT']))
    mapper.connect('/projects/{project_id}/groups/{group_id}/roles/{role_id}',
                   controller=role_controller,
                   action='create_grant',
                   conditions=dict(method=['PUT']))
    mapper.connect('/projects/{project_id}/users/{user_id}/roles/{role_id}',
                   controller=role_controller,
                   action='check_grant',
                   conditions=dict(method=['HEAD']))
    mapper.connect('/projects/{project_id}/groups/{group_id}/roles/{role_id}',
                   controller=role_controller,
                   action='check_grant',
                   conditions=dict(method=['HEAD']))
    mapper.connect('/projects/{project_id}/users/{user_id}/roles',
                   controller=role_controller,
                   action='list_grants',
                   conditions=dict(method=['GET']))
    mapper.connect('/projects/{project_id}/groups/{group_id}/roles',
                   controller=role_controller,
                   action='list_grants',
                   conditions=dict(method=['GET']))
    mapper.connect('/projects/{project_id}/users/{user_id}/roles/{role_id}',
                   controller=role_controller,
                   action='revoke_grant',
                   conditions=dict(method=['DELETE']))
    mapper.connect('/projects/{project_id}/groups/{group_id}/roles/{role_id}',
                   controller=role_controller,
                   action='revoke_grant',
                   conditions=dict(method=['DELETE']))
    mapper.connect('/domains/{domain_id}/users/{user_id}/roles/{role_id}',
                   controller=role_controller,
                   action='create_grant',
                   conditions=dict(method=['PUT']))
    mapper.connect('/domains/{domain_id}/groups/{group_id}/roles/{role_id}',
                   controller=role_controller,
                   action='create_grant',
                   conditions=dict(method=['PUT']))
    mapper.connect('/domains/{domain_id}/users/{user_id}/roles/{role_id}',
                   controller=role_controller,
                   action='check_grant',
                   conditions=dict(method=['HEAD']))
    mapper.connect('/domains/{domain_id}/groups/{group_id}/roles/{role_id}',
                   controller=role_controller,
                   action='check_grant',
                   conditions=dict(method=['HEAD']))
    mapper.connect('/domains/{domain_id}/users/{user_id}/roles',
                   controller=role_controller,
                   action='list_grants',
                   conditions=dict(method=['GET']))
    mapper.connect('/domains/{domain_id}/groups/{group_id}/roles',
                   controller=role_controller,
                   action='list_grants',
                   conditions=dict(method=['GET']))
    mapper.connect('/domains/{domain_id}/users/{user_id}/roles/{role_id}',
                   controller=role_controller,
                   action='revoke_grant',
                   conditions=dict(method=['DELETE']))
    mapper.connect('/domains/{domain_id}/groups/{group_id}/roles/{role_id}',
                   controller=role_controller,
                   action='revoke_grant',
                   conditions=dict(method=['DELETE']))