Exemplo n.º 1
0
    def __init__(self, username=None, password=None, aws_creds=None,
                 auth_url=None, roles=None, is_admin=None, read_only=False,
                 show_deleted=False, overwrite=True, trust_id=None,
                 trustor_user_id=None, request_id=None, auth_token_info=None,
                 region_name=None, auth_plugin=None, trusts_auth_plugin=None,
                 user_domain_id=None, project_domain_id=None,
                 project_name=None, **kwargs):
        """Initialisation of the request context.

        :param overwrite: Set to False to ensure that the greenthread local
            copy of the index is not overwritten.
        """
        if user_domain_id:
            kwargs['user_domain'] = user_domain_id
        if project_domain_id:
            kwargs['project_domain'] = project_domain_id

        super(RequestContext, self).__init__(is_admin=is_admin,
                                             read_only=read_only,
                                             show_deleted=show_deleted,
                                             request_id=request_id,
                                             roles=roles,
                                             overwrite=overwrite,
                                             **kwargs)

        self.username = username
        self.password = password
        self.region_name = region_name
        self.aws_creds = aws_creds
        self.project_name = project_name
        self.auth_token_info = auth_token_info
        self.auth_url = auth_url
        self._session = None
        self._clients = None
        self._keystone_session = session.Session(
            **config.get_ssl_options('keystone'))
        self.trust_id = trust_id
        self.trustor_user_id = trustor_user_id
        self.policy = policy.get_enforcer()
        self._auth_plugin = auth_plugin
        self._trusts_auth_plugin = trusts_auth_plugin

        if is_admin is None:
            self.is_admin = self.policy.check_is_admin(self)
        else:
            self.is_admin = is_admin

        # context scoped cache dict where the key is a class of the type of
        # object being cached and the value is the cache implementation class
        self._object_cache = {}
Exemplo n.º 2
0
    def __init__(self, username=None, password=None, aws_creds=None,
                 auth_url=None, roles=None, is_admin=None, read_only=False,
                 show_deleted=False, overwrite=True, trust_id=None,
                 trustor_user_id=None, request_id=None, auth_token_info=None,
                 region_name=None, auth_plugin=None, trusts_auth_plugin=None,
                 user_domain_id=None, project_domain_id=None,
                 project_name=None, **kwargs):
        """Initialisation of the request context.

        :param overwrite: Set to False to ensure that the greenthread local
            copy of the index is not overwritten.
        """
        if user_domain_id:
            kwargs['user_domain'] = user_domain_id
        if project_domain_id:
            kwargs['project_domain'] = project_domain_id

        super(RequestContext, self).__init__(is_admin=is_admin,
                                             read_only=read_only,
                                             show_deleted=show_deleted,
                                             request_id=request_id,
                                             roles=roles,
                                             overwrite=overwrite,
                                             **kwargs)

        self.username = username
        self.password = password
        self.region_name = region_name
        self.aws_creds = aws_creds
        self.project_name = project_name
        self.auth_token_info = auth_token_info
        self.auth_url = auth_url
        self._session = None
        self._clients = None
        self._keystone_session = session.Session(
            **config.get_ssl_options('keystone'))
        self.trust_id = trust_id
        self.trustor_user_id = trustor_user_id
        self.policy = policy.get_enforcer()
        self._auth_plugin = auth_plugin
        self._trusts_auth_plugin = trusts_auth_plugin

        if is_admin is None:
            self.is_admin = self.policy.check_is_admin(self)
        else:
            self.is_admin = is_admin

        # context scoped cache dict where the key is a class of the type of
        # object being cached and the value is the cache implementation class
        self._object_cache = {}