Skip to content

Commit

Permalink
[VNC OpenStack] Admin can set router interface
Browse files Browse the repository at this point in the history
Authorize administrative users to set router interface even the router
does not belongs to the user's project.

Change-Id: Ie9f44b60a9018f67bd62a49b00aef22a6ec77ac7
Partial-Bug: #1686489
(cherry picked from commit 3bea664)
  • Loading branch information
Édouard Thuleau authored and eonpatapon committed Jun 15, 2017
1 parent dea68de commit 4b37571
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/config/vnc_openstack/vnc_openstack/neutron_plugin_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -3477,7 +3477,8 @@ def add_router_interface(self, context, router_id, port_id=None, subnet_id=None)
router_obj = self._logical_router_read(router_id)
if port_id:
port = self.port_read(port_id)
if port['tenant_id'] != context['tenant_id'].replace('-', ''):
if (not context.get('is_admin', False) and
port['tenant_id'] != context['tenant_id'].replace('-', '')):
self._raise_contrail_exception('RouterInterfaceNotFound',
router_id=router_id,
port_id=port_id)
Expand All @@ -3501,7 +3502,9 @@ def add_router_interface(self, context, router_id, port_id=None, subnet_id=None)

elif subnet_id:
subnet = self.subnet_read(subnet_id)
if subnet['tenant_id'] != context['tenant_id'].replace('-', ''):
if (not context.get('is_admin', False) and
subnet['tenant_id'] !=
context['tenant_id'].replace('-', '')):
self._raise_contrail_exception(
'RouterInterfaceNotFoundForSubnet',
router_id=router_id,
Expand Down

0 comments on commit 4b37571

Please sign in to comment.