function FileResourceTestBase::getExpectedUnauthorizedAccessMessage

Same name in other branches
  1. 9 core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::getExpectedUnauthorizedAccessMessage()
  2. 10 core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::getExpectedUnauthorizedAccessMessage()
  3. 11.x core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::getExpectedUnauthorizedAccessMessage()

Overrides EntityResourceTestBase::getExpectedUnauthorizedAccessMessage

File

core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php, line 219

Class

FileResourceTestBase

Namespace

Drupal\Tests\file\Functional\Rest

Code

protected function getExpectedUnauthorizedAccessMessage($method) {
    if ($this->config('rest.settings')
        ->get('bc_entity_resource_permissions')) {
        if ($method === 'DELETE') {
            return 'Only the file owner can update or delete the file entity.';
        }
        return parent::getExpectedUnauthorizedAccessMessage($method);
    }
    if ($method === 'GET') {
        return "The 'access content' permission is required.";
    }
    if ($method === 'PATCH' || $method === 'DELETE') {
        return 'Only the file owner can update or delete the file entity.';
    }
    return parent::getExpectedUnauthorizedAccessMessage($method);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.