Esempio n. 1
0
    def process_request(self, request):
        headers = request.headers

        all_tenants = strutils.bool_from_string(
            headers.get('X-Test-All-Tenants', 'False'))

        self.make_context(
            request,
            user=headers.get('X-Test-User-ID', self.default_user_id),
            tenant=headers.get('X-Test-Tenant-ID', self.default_tenant_id),
            all_tenants=all_tenants)
Esempio n. 2
0
    def process_request(self, request):
        headers = request.headers

        all_tenants = strutils.bool_from_string(
            headers.get('X-Test-All-Tenants', 'False'))

        self.make_context(request,
                          user=headers.get('X-Test-User-ID',
                                           self.default_user_id),
                          tenant=headers.get('X-Test-Tenant-ID',
                                             self.default_tenant_id),
                          all_tenants=all_tenants)
Esempio n. 3
0
    def make_context(self, request, *args, **kwargs):
        req_id = request.environ.get(request_id.ENV_REQUEST_ID)
        kwargs.setdefault('request_id', req_id)

        ctxt = context.DesignateContext(*args, **kwargs)

        headers = request.headers
        params = request.params

        if headers.get('X-Auth-All-Projects'):
            ctxt.all_tenants = \
                strutils.bool_from_string(headers.get('X-Auth-All-Projects'))
        elif 'all_projects' in params:
            ctxt.all_tenants = \
                strutils.bool_from_string(params['all_projects'])
        elif 'all_tenants' in params:
            ctxt.all_tenants = \
                strutils.bool_from_string(params['all_tenants'])
        else:
            ctxt.all_tenants = False

        request.environ['context'] = ctxt

        return ctxt
Esempio n. 4
0
    def process_request(self, request):
        headers = request.headers

        all_tenants = strutils.bool_from_string(
            headers.get('X-Test-All-Tenants', 'False'))

        context = DesignateContext(
            user=headers.get('X-Test-User-ID', self.default_user_id),
            tenant=headers.get('X-Test-Tenant-ID', self.default_tenant_id),
            all_tenants=all_tenants)

        # Store the context where oslo-log exepcts to find it.
        local.store.context = context

        # Attach the context to the request environment
        request.environ['context'] = context
Esempio n. 5
0
    def process_request(self, request):
        headers = request.headers

        all_tenants = strutils.bool_from_string(
            headers.get('X-Test-All-Tenants', 'False'))

        context = DesignateContext(
            user=headers.get('X-Test-User-ID', self.default_user_id),
            tenant=headers.get('X-Test-Tenant-ID', self.default_tenant_id),
            all_tenants=all_tenants)

        # Store the context where oslo-log exepcts to find it.
        local.store.context = context

        # Attach the context to the request environment
        request.environ['context'] = context