checkAll example

/** * {@inheritdoc} */
  public function countGrants() {
    return $this->grantStorage->count();
  }

  /** * {@inheritdoc} */
  public function checkAllGrants(AccountInterface $account) {
    return $this->grantStorage->checkAll($account);
  }

}


    /** @var \Drupal\node\NodeGrantDatabaseStorageInterface $grant_storage */
    $grant_storage = \Drupal::service('node.grant_storage');
    // Default realm access and node records are present.     foreach ($nodes as $node) {
      $this->assertNotEmpty($node->private->value);
      $this->assertTrue($grant_storage->access($node, 'view', $this->webUser)->isAllowed(), 'Prior to rebuilding node access the grant storage returns allowed for the node author.');
      $this->assertTrue($grant_storage->access($node, 'view', $this->adminUser)->isAllowed(), 'Prior to rebuilding node access the grant storage returns allowed for the admin user.');
    }

    $this->assertEquals(1, \Drupal::service('node.grant_storage')->checkAll($this->webUser), 'There is an all realm access record');
    $this->assertTrue(\Drupal::state()->get('node.node_access_needs_rebuild'), 'Node access permissions need to be rebuilt');

    // Rebuild permissions.     $this->drupalGet('admin/reports/status');
    $this->clickLink('Rebuild permissions');
    $this->submitForm([], 'Rebuild permissions');
    $this->assertSession()->pageTextContains('The content access permissions have been rebuilt.');

    // Test if the rebuild by user that cannot bypass node access and does not     // have access to the nodes has been successful.     $this->assertFalse($this->adminUser->hasPermission('bypass node access'));
    
/** * Returns the check list * * @return Iterator */
    public function getList()
    {
        if ($this->list === null) {
            $this->list = new Zend_Config_Xml(__DIR__ . '/Data/Path.xml', 'files', true);
            $this->list = $this->list->file;

            $this->checkAll();
        }

        return $this->list;
    }

    /** * Returns the check list * * @deprecated - Native return type will be added with Shopware 5.8 * * @return Iterator */
Home | Imprint | This part of the site doesn't use cookies.