Merge "Set user_id when creating leases"
This commit is contained in:
commit
7977c90152
@ -49,6 +49,11 @@ class API(object):
|
||||
:param data: New lease characteristics.
|
||||
:type data: dict
|
||||
"""
|
||||
# TODO(priteau): If possible, extend the context object used in the
|
||||
# manager to keep track of the trustor, instead of using the following
|
||||
# two lines
|
||||
ctx = context.current()
|
||||
data['user_id'] = ctx.user_id
|
||||
return self.manager_rpcapi.create_lease(data)
|
||||
|
||||
@policy.authorize('leases', 'get')
|
||||
|
@ -208,7 +208,9 @@ class ManagerService(service_utils.RPCServer):
|
||||
'Start date must later than current date')
|
||||
|
||||
with trusts.create_ctx_from_trust(trust_id) as ctx:
|
||||
lease_values['user_id'] = ctx.user_id
|
||||
# NOTE(priteau): We should not get user_id from ctx, because we are
|
||||
# in the context of the trustee (blazar user).
|
||||
# lease_values['user_id'] is set in blazar/api/v1/service.py
|
||||
lease_values['project_id'] = ctx.project_id
|
||||
lease_values['start_date'] = start_date
|
||||
lease_values['end_date'] = end_date
|
||||
|
Loading…
Reference in New Issue
Block a user