You are here

public function DataPolicy::revisionEditAccess in Data Policy 8

Check access to revision edit page.

Parameters

int $data_policy_revision: The data policy revision ID.

Return value

\Drupal\Core\Access\AccessResultInterface Allow editing revision if it never been active.

File

src/Controller/DataPolicy.php, line 364

Class

DataPolicy
Class DataPolicy.

Namespace

Drupal\data_policy\Controller

Code

public function revisionEditAccess($data_policy_revision) {
  if ($this
    ->currentUser()
    ->hasPermission('administer data policy entities') || $this
    ->currentUser()
    ->hasPermission('edit data policy')) {
    $ids = $this->dataPolicyConsentManager
      ->getConfig('revision_ids');
    if (!isset($ids[$data_policy_revision])) {
      return AccessResult::allowed();
    }
  }
  return AccessResult::forbidden();
}