Tolerate roles in context.RequestContext
In Ia575ba803a0fb70f39146bd75d381ed19414bd23, oslo.context added roles support in the context itself. Once that change is released in oslo.context and the global requirements has been updated, we should switch to passing in the roles in the __init__ parameter. Until then we should set self.roles *after* the constructor since the constructor sets the roles to None when the new library gets released. Closes-Bug: 1549317 Change-Id: Ie28a4144ccac5d6894405ba7f801617376e35c51
This commit is contained in:
parent
59c4960417
commit
b0ae5e9f2d
@ -33,18 +33,20 @@ class RequestContext(context.RequestContext):
|
||||
before sending back to API call.
|
||||
|
||||
"""
|
||||
self.is_public_api = is_public_api
|
||||
self.domain_id = domain_id
|
||||
self.domain_name = domain_name
|
||||
self.roles = roles or []
|
||||
self.show_password = show_password
|
||||
|
||||
super(RequestContext, self).__init__(auth_token=auth_token,
|
||||
user=user, tenant=tenant,
|
||||
is_admin=is_admin,
|
||||
read_only=read_only,
|
||||
show_deleted=show_deleted,
|
||||
request_id=request_id)
|
||||
self.is_public_api = is_public_api
|
||||
self.domain_id = domain_id
|
||||
self.domain_name = domain_name
|
||||
self.show_password = show_password
|
||||
# NOTE(dims): roles was added in context.RequestContext recently.
|
||||
# we should pass roles in __init__ above instead of setting the
|
||||
# value here once the minimum version of oslo.context is updated.
|
||||
self.roles = roles or []
|
||||
|
||||
def to_dict(self):
|
||||
return {'auth_token': self.auth_token,
|
||||
|
Loading…
Reference in New Issue
Block a user