Loading modules/cloud_service_providers/openstack/openstack.module +27 −14 Original line number Diff line number Diff line Loading @@ -1483,6 +1483,7 @@ function openstack_entity_operation(EntityInterface $entity): array { $operations = []; $account = \Drupal::currentUser(); // OpenStack volume. if ($entity->getEntityTypeId() === 'openstack_volume') { if ($account->hasPermission('edit any openstack volume') || ($account->hasPermission('edit own openstack volume') Loading @@ -1505,6 +1506,7 @@ function openstack_entity_operation(EntityInterface $entity): array { } if ($account->hasPermission('add openstack snapshot')) { if ($entity->getState() === 'available') { $operations['create_snapshot'] = [ 'title' => t('Create Snapshot'), 'url' => Url::fromRoute( Loading @@ -1518,7 +1520,11 @@ function openstack_entity_operation(EntityInterface $entity): array { ]; } } elseif ($entity->getEntityTypeId() === 'openstack_floating_ip') { return $operations; } // OpenStack floating IP. if ($entity->getEntityTypeId() === 'openstack_floating_ip') { if ($account->hasPermission('edit any openstack floating ip') || ($account->hasPermission('edit own openstack floating ip') && !empty($entity->getOwner()) Loading @@ -1536,8 +1542,11 @@ function openstack_entity_operation(EntityInterface $entity): array { ]; } } return $operations; } elseif ($entity->getEntityTypeId() === 'openstack_snapshot') { // OpenStack snapshot. if ($entity->getEntityTypeId() === 'openstack_snapshot') { if ($account->hasPermission('add openstack volume')) { $operations['create_volume'] = [ 'title' => t('Create Volume'), Loading @@ -1551,8 +1560,11 @@ function openstack_entity_operation(EntityInterface $entity): array { 'weight' => 20, ]; } return $operations; } elseif ($entity->getEntityTypeId() === 'openstack_instance') { // OpenStack instance. if ($entity->getEntityTypeId() === 'openstack_instance') { if ($account->hasPermission('edit any openstack instance') || ($account->hasPermission('edit own openstack instance') && !empty($entity->getOwner()) Loading @@ -1577,6 +1589,7 @@ function openstack_entity_operation(EntityInterface $entity): array { ]; } } return $operations; } return $operations; Loading modules/cloud_service_providers/openstack/tests/mock_data/Functional/OpenStack/OpenStackVolumeTest.yml +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ CreateVolume: VolumeId: {{volume_id}} VolumeType: {{volume_type}} CreateTime: '{{create_time}}' State: creating State: available Tags: - Key: 'aws_cloud_volume_{{uid_tag_key}}' Value: '{{uid}}' Loading Loading
modules/cloud_service_providers/openstack/openstack.module +27 −14 Original line number Diff line number Diff line Loading @@ -1483,6 +1483,7 @@ function openstack_entity_operation(EntityInterface $entity): array { $operations = []; $account = \Drupal::currentUser(); // OpenStack volume. if ($entity->getEntityTypeId() === 'openstack_volume') { if ($account->hasPermission('edit any openstack volume') || ($account->hasPermission('edit own openstack volume') Loading @@ -1505,6 +1506,7 @@ function openstack_entity_operation(EntityInterface $entity): array { } if ($account->hasPermission('add openstack snapshot')) { if ($entity->getState() === 'available') { $operations['create_snapshot'] = [ 'title' => t('Create Snapshot'), 'url' => Url::fromRoute( Loading @@ -1518,7 +1520,11 @@ function openstack_entity_operation(EntityInterface $entity): array { ]; } } elseif ($entity->getEntityTypeId() === 'openstack_floating_ip') { return $operations; } // OpenStack floating IP. if ($entity->getEntityTypeId() === 'openstack_floating_ip') { if ($account->hasPermission('edit any openstack floating ip') || ($account->hasPermission('edit own openstack floating ip') && !empty($entity->getOwner()) Loading @@ -1536,8 +1542,11 @@ function openstack_entity_operation(EntityInterface $entity): array { ]; } } return $operations; } elseif ($entity->getEntityTypeId() === 'openstack_snapshot') { // OpenStack snapshot. if ($entity->getEntityTypeId() === 'openstack_snapshot') { if ($account->hasPermission('add openstack volume')) { $operations['create_volume'] = [ 'title' => t('Create Volume'), Loading @@ -1551,8 +1560,11 @@ function openstack_entity_operation(EntityInterface $entity): array { 'weight' => 20, ]; } return $operations; } elseif ($entity->getEntityTypeId() === 'openstack_instance') { // OpenStack instance. if ($entity->getEntityTypeId() === 'openstack_instance') { if ($account->hasPermission('edit any openstack instance') || ($account->hasPermission('edit own openstack instance') && !empty($entity->getOwner()) Loading @@ -1577,6 +1589,7 @@ function openstack_entity_operation(EntityInterface $entity): array { ]; } } return $operations; } return $operations; Loading
modules/cloud_service_providers/openstack/tests/mock_data/Functional/OpenStack/OpenStackVolumeTest.yml +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ CreateVolume: VolumeId: {{volume_id}} VolumeType: {{volume_type}} CreateTime: '{{create_time}}' State: creating State: available Tags: - Key: 'aws_cloud_volume_{{uid_tag_key}}' Value: '{{uid}}' Loading