Remove owner_is_tenant from RequestContext

This appears to be a leftover from glance, and we don't support
anything other than tenant-scoped requests.

Change-Id: Ibce0e38ee24f18de24733a35d25c90c03b46dc6e
blueprint: request-scoping-policy
This commit is contained in:
Steven Hardy 2013-11-29 15:13:22 +00:00
parent 9a17f8cf0b
commit 16d6aceb44

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg
from heat.openstack.common import local from heat.openstack.common import local
from heat.common import exception from heat.common import exception
from heat.common import policy from heat.common import policy
@ -39,8 +37,7 @@ class RequestContext(context.RequestContext):
aws_creds=None, tenant=None, aws_creds=None, tenant=None,
tenant_id=None, auth_url=None, roles=None, is_admin=None, tenant_id=None, auth_url=None, roles=None, is_admin=None,
read_only=False, show_deleted=False, read_only=False, show_deleted=False,
owner_is_tenant=True, overwrite=True, overwrite=True, trust_id=None, trustor_user_id=None,
trust_id=None, trustor_user_id=None,
request_id=None, **kwargs): request_id=None, **kwargs):
""" """
:param overwrite: Set to False to ensure that the greenthread local :param overwrite: Set to False to ensure that the greenthread local
@ -62,7 +59,6 @@ class RequestContext(context.RequestContext):
self.tenant_id = tenant_id self.tenant_id = tenant_id
self.auth_url = auth_url self.auth_url = auth_url
self.roles = roles or [] self.roles = roles or []
self.owner_is_tenant = owner_is_tenant
if overwrite or not hasattr(local.store, 'context'): if overwrite or not hasattr(local.store, 'context'):
self.update_store() self.update_store()
self._session = None self._session = None
@ -103,11 +99,6 @@ class RequestContext(context.RequestContext):
def from_dict(cls, values): def from_dict(cls, values):
return cls(**values) return cls(**values)
@property
def owner(self):
"""Return the owner to correlate with an image."""
return self.tenant if self.owner_is_tenant else self.user
def get_admin_context(read_deleted="no"): def get_admin_context(read_deleted="no"):
return RequestContext(is_admin=True) return RequestContext(is_admin=True)
@ -115,11 +106,7 @@ def get_admin_context(read_deleted="no"):
class ContextMiddleware(wsgi.Middleware): class ContextMiddleware(wsgi.Middleware):
opts = [cfg.BoolOpt('owner_is_tenant', default=True)]
def __init__(self, app, conf, **local_conf): def __init__(self, app, conf, **local_conf):
cfg.CONF.register_opts(self.opts)
# Determine the context class to use # Determine the context class to use
self.ctxcls = RequestContext self.ctxcls = RequestContext
if 'context_class' in local_conf: if 'context_class' in local_conf:
@ -131,8 +118,6 @@ class ContextMiddleware(wsgi.Middleware):
""" """
Create a context with the given arguments. Create a context with the given arguments.
""" """
kwargs.setdefault('owner_is_tenant', cfg.CONF.owner_is_tenant)
return self.ctxcls(*args, **kwargs) return self.ctxcls(*args, **kwargs)
def process_request(self, req): def process_request(self, req):