Merge "Bump network rev on RBAC change"
This commit is contained in:
commit
8f79a92e45
@ -262,7 +262,9 @@ class Network(standard_attr.HasStandardAttributes, model_base.BASEV2,
|
||||
admin_state_up = sa.Column(sa.Boolean)
|
||||
vlan_transparent = sa.Column(sa.Boolean, nullable=True)
|
||||
rbac_entries = orm.relationship(rbac_db_models.NetworkRBAC,
|
||||
backref='network', lazy='subquery',
|
||||
backref=orm.backref('network',
|
||||
load_on_pending=True),
|
||||
lazy='subquery',
|
||||
cascade='all, delete, delete-orphan')
|
||||
availability_zone_hints = sa.Column(sa.String(255))
|
||||
dhcp_agents = orm.relationship(
|
||||
|
@ -94,6 +94,7 @@ class NetworkRBAC(RBACColumns, model_base.BASEV2):
|
||||
|
||||
object_id = _object_id_column('networks.id')
|
||||
object_type = 'network'
|
||||
revises_on_change = ('network', )
|
||||
|
||||
def get_valid_actions(self):
|
||||
actions = (ACCESS_SHARED,)
|
||||
|
@ -423,6 +423,21 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
target_tenant=self.client2.tenant_id)
|
||||
self.client.delete_port(port['id'])
|
||||
|
||||
@test.requires_ext(extension="standard-attr-revisions", service="network")
|
||||
@decorators.idempotent_id('86c3529b-1231-40de-1234-89664291a4cb')
|
||||
def test_rbac_bumps_network_revision(self):
|
||||
resp = self._make_admin_net_and_subnet_shared_to_tenant_id(
|
||||
self.client.tenant_id)
|
||||
net_id = resp['network']['id']
|
||||
rev = self.client.show_network(net_id)['network']['revision_number']
|
||||
self.admin_client.create_rbac_policy(
|
||||
object_type='network', object_id=net_id,
|
||||
action='access_as_shared', target_tenant='*')
|
||||
self.assertGreater(
|
||||
self.client.show_network(net_id)['network']['revision_number'],
|
||||
rev
|
||||
)
|
||||
|
||||
@decorators.idempotent_id('86c3529b-1231-40de-803c-aeeeeeee7fff')
|
||||
def test_filtering_works_with_rbac_records_present(self):
|
||||
resp = self._make_admin_net_and_subnet_shared_to_tenant_id(
|
||||
|
Loading…
Reference in New Issue
Block a user