Mercurial > hg > isophonics-drupal-site
comparison core/modules/comment/src/CommentAccessControlHandler.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children | af1871eacc83 |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
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 } |