Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/comment/src/CommentAccessControlHandler.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children | 12f9dff5fda9 |
comparison
equal
deleted
inserted
replaced
3:307d7a7fd348 | 4:a9cd425dd02b |
---|---|
43 } | 43 } |
44 | 44 |
45 return $access_result; | 45 return $access_result; |
46 | 46 |
47 case 'update': | 47 case 'update': |
48 return AccessResult::allowedIf($account->id() && $account->id() == $entity->getOwnerId() && $entity->isPublished() && $account->hasPermission('edit own comments'))->cachePerPermissions()->cachePerUser()->addCacheableDependency($entity); | 48 $access_result = AccessResult::allowedIf($account->id() && $account->id() == $entity->getOwnerId() && $entity->isPublished() && $account->hasPermission('edit own comments')) |
49 ->cachePerPermissions()->cachePerUser()->addCacheableDependency($entity); | |
50 if (!$access_result->isAllowed()) { | |
51 $access_result->setReason("The 'edit own comments' permission is required, the user must be the comment author, and the comment must be published."); | |
52 } | |
53 return $access_result; | |
49 | 54 |
50 default: | 55 default: |
51 // No opinion. | 56 // No opinion. |
52 return AccessResult::neutral()->cachePerPermissions(); | 57 return AccessResult::neutral()->cachePerPermissions(); |
53 } | 58 } |