You are here

public function SocialAlbumController::checkDeleteImageAccess in Open Social 10.2.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_album/src/Controller/SocialAlbumController.php \Drupal\social_album\Controller\SocialAlbumController::checkDeleteImageAccess()
  2. 10.0.x modules/social_features/social_album/src/Controller/SocialAlbumController.php \Drupal\social_album\Controller\SocialAlbumController::checkDeleteImageAccess()
  3. 10.1.x modules/social_features/social_album/src/Controller/SocialAlbumController.php \Drupal\social_album\Controller\SocialAlbumController::checkDeleteImageAccess()

Checks access to the page for deleting the image from the post.

Parameters

\Drupal\node\NodeInterface $node: The node entity object.

\Drupal\social_post\Entity\PostInterface $post: The post entity object.

int $fid: The file entity ID.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

1 string reference to 'SocialAlbumController::checkDeleteImageAccess'
social_album.routing.yml in modules/social_features/social_album/social_album.routing.yml
modules/social_features/social_album/social_album.routing.yml

File

modules/social_features/social_album/src/Controller/SocialAlbumController.php, line 278

Class

SocialAlbumController
Returns responses for Album routes.

Namespace

Drupal\social_album\Controller

Code

public function checkDeleteImageAccess(NodeInterface $node, PostInterface $post, $fid) {
  $access = $this
    ->checkViewImageAccess($node, $post, $fid, 'delete');
  if ($access
    ->isAllowed()) {
    $access = $access
      ->andIf(AccessResult::allowedIf($post
      ->getOwnerId() === $this
      ->currentUser()
      ->id()));
  }
  return $access;
}