Commit 9042853d authored by xiaohua guan's avatar xiaohua guan Committed by Yas Naoi
Browse files

Issue #3318898 by Xiaohua Guan, yas: Create entity type OpenStack Quota

parent 4614616a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1680,3 +1680,10 @@ function openstack_update_8275() {
  \Drupal::service('cloud')->updateYmlDefinitions($files, 'openstack');
  drupal_flush_all_caches();
}

/**
 * Add entity type openstack_quota.
 */
function openstack_update_8276() {
  openstack_add_entity_type('openstack_quota');
}
+28 −0
Original line number Diff line number Diff line
@@ -377,3 +377,31 @@ edit own openstack router:
delete own openstack router:
  title: 'Delete own OpenStack router'
  description: 'Allow users to delete own router.'

####################
# Quotas
####################
add openstack quota:
  title: 'Add OpenStack quota'
  description: 'Allow users to add quota.'
list openstack quota:
  title: 'List OpenStack quota'
  description: 'Allow users to list quota.'
view any openstack quota:
  title: 'View any OpenStack quota'
  description: 'Allow users to view any quota.'
edit any openstack quota:
  title: 'Edit any OpenStack quota'
  description: 'Allow users to edit any quota.'
delete any openstack quota:
  title: 'Delete any OpenStack quota'
  description: 'Allow users to delete any quota.'
view own openstack quota:
  title: 'View own OpenStack quota'
  description: 'Allow users to view own quota.'
edit own openstack quota:
  title: 'Edit own OpenStack quota'
  description: 'Allow users to edit own quota.'
delete own openstack quota:
  title: 'Delete own OpenStack quota'
  description: 'Allow users to delete own quota.'
+21 −0
Original line number Diff line number Diff line
@@ -1219,3 +1219,24 @@ entity.openstack_router.list_update.all:
    _custom_access: '\Drupal\cloud\Controller\CloudConfigController::checkAccessForUpdateAll'
  options:
    entity_type: 'openstack_router'

# OpenStack quotas routes.
entity.openstack_quota.list_update:
  path: '/clouds/openstack/{cloud_context}/quota/update'
  defaults:
    _controller: '\Drupal\openstack\Controller\ApiController::updateQuotaList'
  requirements:
    # Use custom access that will check for cloud_context and the desired permission.
    # Desired permission is passed as an option in the "perm" variable
    _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access'
  options:
    perm: 'edit any openstack quota+edit own openstack quota'

entity.openstack_quota.list_update.all:
  path: '/clouds/openstack/quota/update'
  defaults:
    _controller: '\Drupal\openstack\Controller\ApiController::updateQuotaList'
  requirements:
    _custom_access: '\Drupal\cloud\Controller\CloudConfigController::checkAccessForUpdateAll'
  options:
    entity_type: 'openstack_quota'
+7 −0
Original line number Diff line number Diff line
@@ -289,6 +289,13 @@ class ApiController extends ControllerBase implements ApiControllerInterface {
    return $this->updateResourceList('openstack_router', $cloud_context);
  }

  /**
   * {@inheritdoc}
   */
  public function updateQuotaList($cloud_context = ''): RedirectResponse {
    return $this->updateResourceList('openstack_quota', $cloud_context);
  }

  /**
   * {@inheritdoc}
   */
+11 −0
Original line number Diff line number Diff line
@@ -132,6 +132,17 @@ interface ApiControllerInterface {
   */
  public function updateRouterList($cloud_context): RedirectResponse;

  /**
   * Update all quotas in particular cloud region.
   *
   * @param string $cloud_context
   *   Cloud context string.
   *
   * @return \Symfony\Component\HttpFoundation\RedirectResponse
   *   A redirect response object that may be returned by the controller.
   */
  public function updateQuotaList($cloud_context): RedirectResponse;

  /**
   * Update all Floating IPs in particular cloud region.
   *
Loading