In Drupal\content_entity_example\ContactAccessControlHandler you have the following method:

 /**
   * {@inheritdoc}
   *
   * Link the activities to the permissions. checkAccess is called with the
   * $operation as defined in the routing.yml file.
   */
  protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
    switch ($operation) {
      case 'view':
        return AccessResult::allowedIfHasPermission($account, 'view contact entity');

      case 'edit':
        return AccessResult::allowedIfHasPermission($account, 'edit contact entity');

      case 'delete':
        return AccessResult::allowedIfHasPermission($account, 'delete contact entity');
    }
    return AccessResult::allowed();
  }

the "edit" operation does not exist, this should be changed to update.

Patch attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JeroenT created an issue. See original summary.

Status: Needs review » Needs work

The last submitted patch, contactAccessControlHandler-update-operation.patch, failed testing.

Mile23’s picture

Status: Needs work » Postponed (maintainer needs more info)

I'm not seeing any errors while editing contact entities.

Please offer steps to reproduce the problem if it still exists. Thanks.

Mile23’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

This is a duplicate of #2913655: ContactAccessControlHandler creates access bypass? where there's more code and we'll be adding tests.

Thanks!