"""
- def __init__(self, user_id, tenant_id, is_admin=None, read_deleted="no",
- roles=None, timestamp=None, request_id=None, tenant_name=None,
+ @removals.removed_kwarg('read_deleted')
+ def __init__(self, user_id, tenant_id, is_admin=None, roles=None,
+ timestamp=None, request_id=None, tenant_name=None,
user_name=None, overwrite=True, auth_token=None, **kwargs):
"""Object initialization.
- :param read_deleted: 'no' indicates deleted records are hidden, 'yes'
- indicates deleted records are visible, 'only' indicates that
- *only* deleted records are visible.
-
:param overwrite: Set to False to ensure that the greenthread local
copy of the index is not overwritten.
self.user_name = user_name
self.tenant_name = tenant_name
- self.read_deleted = read_deleted
if not timestamp:
timestamp = datetime.datetime.utcnow()
self.timestamp = timestamp
def user_id(self, user_id):
self.user = user_id
- def _get_read_deleted(self):
- return self._read_deleted
-
- def _set_read_deleted(self, read_deleted):
- if read_deleted not in ('no', 'yes', 'only'):
- raise ValueError(_("read_deleted can only be one of 'no', "
- "'yes' or 'only', not %r") % read_deleted)
- self._read_deleted = read_deleted
-
- def _del_read_deleted(self):
- del self._read_deleted
-
- read_deleted = property(_get_read_deleted, _set_read_deleted,
- _del_read_deleted)
-
def to_dict(self):
context = super(ContextBase, self).to_dict()
context.update({
'user_id': self.user_id,
'tenant_id': self.tenant_id,
'project_id': self.project_id,
- 'read_deleted': self.read_deleted,
'roles': self.roles,
'timestamp': str(self.timestamp),
'tenant_name': self.tenant_name,
def from_dict(cls, values):
return cls(**values)
+ @removals.removed_kwarg('read_deleted')
def elevated(self, read_deleted=None):
"""Return a version of this context with admin flag set."""
context = copy.copy(self)
if 'admin' not in [x.lower() for x in context.roles]:
context.roles = context.roles + ["admin"]
- if read_deleted is not None:
- context.read_deleted = read_deleted
-
return context
return self._session
+@removals.removed_kwarg('read_deleted')
@removals.removed_kwarg('load_admin_roles')
def get_admin_context(read_deleted="no", load_admin_roles=True):
return Context(user_id=None,
tenant_id=None,
is_admin=True,
- read_deleted=read_deleted,
overwrite=False)
+@removals.removed_kwarg('read_deleted')
def get_admin_context_without_session(read_deleted="no"):
return ContextBase(user_id=None,
tenant_id=None,
- is_admin=True,
- read_deleted=read_deleted)
+ is_admin=True)
def _get_non_admin_context(self):
return context.Context(user_id=None,
tenant_id=self._tenant_id,
- is_admin=False,
- read_deleted="no")
+ is_admin=False)
def test_port_vif_details(self):
with self.port(name='name') as port:
# By default user is admin - now test non admin user
ctx = context.Context(user_id=None,
tenant_id=self._tenant_id,
- is_admin=False,
- read_deleted="no")
+ is_admin=False)
non_admin_port = self._show(
'ports', port_id, neutron_context=ctx)['port']
self._check_response_no_portbindings_host(non_admin_port)
# By default user is admin - now test non admin user
ctx = context.Context(user_id=None,
tenant_id=self._tenant_id,
- is_admin=False,
- read_deleted="no")
+ is_admin=False)
ports = self._list('ports', neutron_context=ctx)['ports']
self.assertEqual(2, len(ports))
for non_admin_port in ports:
# By default user is admin - now test non admin user
ctx = context.Context(user_id=None,
tenant_id=self._tenant_id,
- is_admin=False,
- read_deleted="no")
+ is_admin=False)
non_admin_port = self._show(
'ports', port_id, neutron_context=ctx)['port']
self._check_response_portbindings_vnic_type(non_admin_port)
# By default user is admin - now test non admin user
ctx = context.Context(user_id=None,
tenant_id=self._tenant_id,
- is_admin=False,
- read_deleted="no")
+ is_admin=False)
ports = self._list('ports', neutron_context=ctx)['ports']
self.assertEqual(2, len(ports))
for non_admin_port in ports: