Skip to content

Commit c488124

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Pass the actual target in networks policy"
2 parents 3db73e5 + fb3bf32 commit c488124

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

nova/api/openstack/compute/networks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def __init__(self, network_api=None):
7070
@wsgi.expected_errors(())
7171
def index(self, req):
7272
context = req.environ['nova.context']
73-
context.can(net_policies.POLICY_ROOT % 'list')
73+
context.can(net_policies.POLICY_ROOT % 'list',
74+
target={'project_id': context.project_id})
7475
networks = self.network_api.get_all(context)
7576
result = [network_dict(context, net_ref) for net_ref in networks]
7677
return {'networks': result}
@@ -79,7 +80,8 @@ def index(self, req):
7980
@wsgi.expected_errors(404)
8081
def show(self, req, id):
8182
context = req.environ['nova.context']
82-
context.can(net_policies.POLICY_ROOT % 'show')
83+
context.can(net_policies.POLICY_ROOT % 'show',
84+
target={'project_id': context.project_id})
8385

8486
try:
8587
network = self.network_api.get(context, id)

0 commit comments

Comments
 (0)