diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index bdf53bf..186080d 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -459,9 +459,9 @@ function comment_node_update_index(EntityInterface $node, $langcode) { // comments. $index_comments = TRUE; $roles = \Drupal::entityManager()->getStorage('user_role')->loadMultiple(); - $authenticated_can_access = $roles[DRUPAL_AUTHENTICATED_RID]->hasPermission('access comments'); + $authenticated_can_access = $roles[DRUPAL_AUTHENTICATED_RID]->hasPermission('access_comments'); foreach ($roles as $rid => $role) { - if ($role->hasPermission('search content') && !$role->hasPermission('access comments')) { + if ($role->hasPermission('search content') && !$role->hasPermission('access_comments')) { if ($rid == DRUPAL_AUTHENTICATED_RID || $rid == DRUPAL_ANONYMOUS_RID || !$authenticated_can_access) { $index_comments = FALSE; break; @@ -520,7 +520,7 @@ function comment_node_search_result(EntityInterface $node) { } // Do not make a string if comments are hidden. $status = $node->get($field_name)->status; - if (\Drupal::currentUser()->hasPermission('access comments') && $status != CommentItemInterface::HIDDEN) { + if (\Drupal::currentUser()->hasPermission('access_comments') && $status != CommentItemInterface::HIDDEN) { if ($status == CommentItemInterface::OPEN) { // At least one comment field is open. $open = TRUE; diff --git a/core/modules/comment/comment.permissions.yml b/core/modules/comment/comment.permissions.yml index 664b5e1..5446d1c 100644 --- a/core/modules/comment/comment.permissions.yml +++ b/core/modules/comment/comment.permissions.yml @@ -1,13 +1,13 @@ -administer comments: +administer_comments: title: 'Administer comments and comment settings' -administer comment types: +administer_comment_types: title: 'Administer comment types and settings' restrict access: true -access comments: +access_comments: title: 'View comments' -post comments: +post_comments: title: 'Post comments' -skip comment approval: +skip_comment_approval: title: 'Skip comment approval' -edit own comments: +edit_own_comments: title: 'Edit own comments' diff --git a/core/modules/comment/comment.routing.yml b/core/modules/comment/comment.routing.yml index ca37c61..9dd7714 100644 --- a/core/modules/comment/comment.routing.yml +++ b/core/modules/comment/comment.routing.yml @@ -5,7 +5,7 @@ comment.admin: _content: '\Drupal\comment\Controller\AdminController::adminPage' type: 'new' requirements: - _permission: 'administer comments' + _permission: 'administer_comments' comment.admin_approval: path: '/admin/content/comment/approval' @@ -14,7 +14,7 @@ comment.admin_approval: _content: '\Drupal\comment\Controller\AdminController::adminPage' type: 'approval' requirements: - _permission: 'administer comments' + _permission: 'administer_comments' entity.comment.edit_form: path: '/comment/{comment}/edit' @@ -84,7 +84,7 @@ comment.type_list: _entity_list: 'comment_type' _title: 'Comment types' requirements: - _permission: 'administer comment types' + _permission: 'administer_comment_types' options: _admin_route: TRUE @@ -104,7 +104,7 @@ entity.comment_type.add_form: _entity_form: 'comment_type.add' _title: 'Add' requirements: - _permission: 'administer comment types' + _permission: 'administer_comment_types' options: _admin_route: TRUE diff --git a/core/modules/comment/config/install/views.view.comments_recent.yml b/core/modules/comment/config/install/views.view.comments_recent.yml index 7a4b559..4748738 100644 --- a/core/modules/comment/config/install/views.view.comments_recent.yml +++ b/core/modules/comment/config/install/views.view.comments_recent.yml @@ -21,7 +21,7 @@ display: access: type: perm options: - perm: 'access comments' + perm: 'access_comments' provider: user cache: type: none diff --git a/core/modules/comment/src/CommentAccessControlHandler.php b/core/modules/comment/src/CommentAccessControlHandler.php index b78c4b0..f442ece 100644 --- a/core/modules/comment/src/CommentAccessControlHandler.php +++ b/core/modules/comment/src/CommentAccessControlHandler.php @@ -27,18 +27,18 @@ class CommentAccessControlHandler extends EntityAccessControlHandler { protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) { /** @var \Drupal\Core\Entity\EntityInterface|\Drupal\user\EntityOwnerInterface $entity */ - if ($account->hasPermission('administer comments')) { + if ($account->hasPermission('administer_comments')) { $access = AccessResult::allowed()->cachePerRole(); return ($operation != 'view') ? $access : $access->andIf($entity->getCommentedEntity()->access($operation, $account, TRUE)); } switch ($operation) { case 'view': - return AccessResult::allowedIf($account->hasPermission('access comments') && $entity->isPublished())->cachePerRole()->cacheUntilEntityChanges($entity) + return AccessResult::allowedIf($account->hasPermission('access_comments') && $entity->isPublished())->cachePerRole()->cacheUntilEntityChanges($entity) ->andIf($entity->getCommentedEntity()->access($operation, $account, TRUE)); case 'update': - return AccessResult::allowedIf($account->id() && $account->id() == $entity->getOwnerId() && $entity->isPublished() && $account->hasPermission('edit own comments'))->cachePerRole()->cachePerUser()->cacheUntilEntityChanges($entity); + return AccessResult::allowedIf($account->id() && $account->id() == $entity->getOwnerId() && $entity->isPublished() && $account->hasPermission('edit_own_comments'))->cachePerRole()->cachePerUser()->cacheUntilEntityChanges($entity); default: // No opinion. @@ -50,7 +50,7 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A * {@inheritdoc} */ protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { - return AccessResult::allowedIfHasPermission($account, 'post comments'); + return AccessResult::allowedIfHasPermission($account, 'post_comments'); } /** @@ -60,7 +60,7 @@ protected function checkFieldAccess($operation, FieldDefinitionInterface $field_ /** @var \Drupal\comment\CommentInterface $entity */ $entity = $items->getEntity(); if ($operation == 'edit') { - // Only users with the "administer comments" permission can edit + // Only users with the "administer_comments" permission can edit // administrative fields. $administrative_fields = array( 'uid', @@ -69,7 +69,7 @@ protected function checkFieldAccess($operation, FieldDefinitionInterface $field_ 'date', ); if (in_array($field_definition->getName(), $administrative_fields, TRUE)) { - return AccessResult::allowedIfHasPermission($account, 'administer comments'); + return AccessResult::allowedIfHasPermission($account, 'administer_comments'); } // No user can change read-only fields. @@ -95,8 +95,8 @@ protected function checkFieldAccess($operation, FieldDefinitionInterface $field_ // can edit name, homepage and mail. Anonymous users can also fill in the // fields on comment creation. if (in_array($field_definition->getName(), ['name', 'mail', 'homepage'], TRUE)) { - $admin_access = AccessResult::allowedIfHasPermission($account, 'administer comments'); - $anonymous_access = AccessResult::allowedIf($entity->isNew() && $account->isAnonymous() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT && $account->hasPermission('post comments')) + $admin_access = AccessResult::allowedIfHasPermission($account, 'administer_comments'); + $anonymous_access = AccessResult::allowedIf($entity->isNew() && $account->isAnonymous() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT && $account->hasPermission('post_comments')) ->cachePerRole() ->cacheUntilEntityChanges($entity) ->cacheUntilEntityChanges($field_definition->getConfig($commented_entity->bundle())) @@ -107,11 +107,11 @@ protected function checkFieldAccess($operation, FieldDefinitionInterface $field_ if ($operation == 'view') { // Admins can view any fields except hostname, other users need both the - // "access comments" permission and for the comment to be published. The + // "access_comments" permission and for the comment to be published. The // mail field is hidden from non-admins. - $admin_access = AccessResult::allowedIf($account->hasPermission('administer comments') && $field_definition->getName() != 'hostname') + $admin_access = AccessResult::allowedIf($account->hasPermission('administer_comments') && $field_definition->getName() != 'hostname') ->cachePerRole(); - $anonymous_access = AccessResult::allowedIf($account->hasPermission('access comments') && $entity->isPublished() && !in_array($field_definition->getName(), array('mail', 'hostname'), TRUE)) + $anonymous_access = AccessResult::allowedIf($account->hasPermission('access_comments') && $entity->isPublished() && !in_array($field_definition->getName(), array('mail', 'hostname'), TRUE)) ->cacheUntilEntityChanges($entity) ->cachePerRole(); return $admin_access->orIf($anonymous_access); diff --git a/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php index 35e033d..ac523ec 100644 --- a/core/modules/comment/src/CommentForm.php +++ b/core/modules/comment/src/CommentForm.php @@ -85,7 +85,7 @@ public function form(array $form, FormStateInterface $form_state) { $form['#theme'] = array('comment_form__' . $entity->getEntityTypeId() . '__' . $entity->bundle() . '__' . $field_name, 'comment_form'); $anonymous_contact = $field_definition->getSetting('anonymous'); - $is_admin = $comment->id() && $this->currentUser->hasPermission('administer comments'); + $is_admin = $comment->id() && $this->currentUser->hasPermission('administer_comments'); if (!$this->currentUser->isAuthenticated() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT) { $form['#attached']['library'][] = 'core/drupal.form'; @@ -129,7 +129,7 @@ public function form(array $form, FormStateInterface $form_state) { else { $author = ($comment->getAuthorName() ? $comment->getAuthorName() : ''); } - $status = ($this->currentUser->hasPermission('skip comment approval') ? CommentInterface::PUBLISHED : CommentInterface::NOT_PUBLISHED); + $status = ($this->currentUser->hasPermission('skip_comment_approval') ? CommentInterface::PUBLISHED : CommentInterface::NOT_PUBLISHED); } $date = ''; @@ -239,7 +239,7 @@ protected function actions(array $form, FormStateInterface $form_state) { // Only show the save button if comment previews are optional or if we are // already previewing the submission. - $element['submit']['#access'] = ($comment->id() && $this->currentUser->hasPermission('administer comments')) || $preview_mode != DRUPAL_REQUIRED || $form_state->get('comment_preview'); + $element['submit']['#access'] = ($comment->id() && $this->currentUser->hasPermission('administer_comments')) || $preview_mode != DRUPAL_REQUIRED || $form_state->get('comment_preview'); $element['preview'] = array( '#type' => 'submit', @@ -365,7 +365,7 @@ public function save(array $form, FormStateInterface $form_state) { $uri = $entity->urlInfo(); $logger = $this->logger('content'); - if ($this->currentUser->hasPermission('post comments') && ($this->currentUser->hasPermission('administer comments') || $entity->{$field_name}->status == CommentItemInterface::OPEN)) { + if ($this->currentUser->hasPermission('post_comments') && ($this->currentUser->hasPermission('administer_comments') || $entity->{$field_name}->status == CommentItemInterface::OPEN)) { $comment->save(); $form_state->setValue('cid', $comment->id()); @@ -377,7 +377,7 @@ public function save(array $form, FormStateInterface $form_state) { // Explain the approval queue if necessary. if (!$comment->isPublished()) { - if (!$this->currentUser->hasPermission('administer comments')) { + if (!$this->currentUser->hasPermission('administer_comments')) { drupal_set_message($this->t('Your comment has been queued for review by site administrators and will be published after approval.')); } } diff --git a/core/modules/comment/src/CommentLinkBuilder.php b/core/modules/comment/src/CommentLinkBuilder.php index f689b1a..74c9a94 100644 --- a/core/modules/comment/src/CommentLinkBuilder.php +++ b/core/modules/comment/src/CommentLinkBuilder.php @@ -105,7 +105,7 @@ public function buildCommentedEntityLinks(FieldableEntityInterface $entity, arra // Teaser view: display the number of comments that have been posted, // or a link to add new comments if the user has permission, the // entity is open to new comments, and there currently are none. - if ($this->currentUser->hasPermission('access comments')) { + if ($this->currentUser->hasPermission('access_comments')) { if (!empty($entity->get($field_name)->comment_count)) { $links['comment-comments'] = array( 'title' => $this->formatPlural($entity->get($field_name)->comment_count, '1 comment', '@count comments'), @@ -130,7 +130,7 @@ public function buildCommentedEntityLinks(FieldableEntityInterface $entity, arra // Provide a link to new comment form. if ($commenting_status == CommentItemInterface::OPEN) { $comment_form_location = $field_definition->getSetting('form_location'); - if ($this->currentUser->hasPermission('post comments')) { + if ($this->currentUser->hasPermission('post_comments')) { $links['comment-add'] = array( 'title' => $this->t('Add new comment'), 'language' => $entity->language(), @@ -162,10 +162,10 @@ public function buildCommentedEntityLinks(FieldableEntityInterface $entity, arra // comments. if ($commenting_status == CommentItemInterface::OPEN) { $comment_form_location = $field_definition->getSetting('form_location'); - if ($this->currentUser->hasPermission('post comments')) { + if ($this->currentUser->hasPermission('post_comments')) { // Show the "post comment" link if the form is on another page, or // if there are existing comments that the link will skip past. - if ($comment_form_location == CommentItemInterface::FORM_SEPARATE_PAGE || (!empty($entity->get($field_name)->comment_count) && $this->currentUser->hasPermission('access comments'))) { + if ($comment_form_location == CommentItemInterface::FORM_SEPARATE_PAGE || (!empty($entity->get($field_name)->comment_count) && $this->currentUser->hasPermission('access_comments'))) { $links['comment-add'] = array( 'title' => $this->t('Add new comment'), 'attributes' => array('title' => $this->t('Share your thoughts and opinions related to this posting.')), diff --git a/core/modules/comment/src/CommentManager.php b/core/modules/comment/src/CommentManager.php index 0094a01..c62b1e9 100644 --- a/core/modules/comment/src/CommentManager.php +++ b/core/modules/comment/src/CommentManager.php @@ -266,7 +266,7 @@ public function forbiddenMessage(EntityInterface $entity, $field_name) { $this->authenticatedCanPostComments = $this->entityManager ->getStorage('user_role') ->load(DRUPAL_AUTHENTICATED_RID) - ->hasPermission('post comments'); + ->hasPermission('post_comments'); } if ($this->authenticatedCanPostComments) { diff --git a/core/modules/comment/src/CommentStorage.php b/core/modules/comment/src/CommentStorage.php index 2cbaed7..ecc2c1d 100644 --- a/core/modules/comment/src/CommentStorage.php +++ b/core/modules/comment/src/CommentStorage.php @@ -103,7 +103,7 @@ public function getDisplayOrdinal(CommentInterface $comment, $comment_mode, $div $query->innerJoin('comment_field_data', 'c2', 'c2.entity_id = c1.entity_id AND c2.entity_type = c1.entity_type AND c2.field_name = c1.field_name'); $query->addExpression('COUNT(*)', 'count'); $query->condition('c2.cid', $comment->id()); - if (!$this->currentUser->hasPermission('administer comments')) { + if (!$this->currentUser->hasPermission('administer_comments')) { $query->condition('c1.status', CommentInterface::PUBLISHED); } @@ -292,7 +292,7 @@ public function loadThread(EntityInterface $entity, $field_name, $mode, $comment ->addMetaData('entity', $entity) ->addMetaData('field_name', $field_name); - if (!$this->currentUser->hasPermission('administer comments')) { + if (!$this->currentUser->hasPermission('administer_comments')) { $query->condition('c.status', CommentInterface::PUBLISHED); $count_query->condition('c.status', CommentInterface::PUBLISHED); } diff --git a/core/modules/comment/src/Controller/CommentController.php b/core/modules/comment/src/Controller/CommentController.php index af415d0..3523aea 100644 --- a/core/modules/comment/src/Controller/CommentController.php +++ b/core/modules/comment/src/Controller/CommentController.php @@ -157,7 +157,7 @@ public function redirectNode(EntityInterface $node) { * - replies to comments * - replies to entities * - attempts to reply to entities that can no longer accept comments - * - respecting access permissions ('access comments', 'post comments', + * - respecting access permissions ('access_comments', 'post_comments', * etc.) * * @param \Symfony\Component\HttpFoundation\Request $request @@ -201,7 +201,7 @@ public function getReplyForm(Request $request, EntityInterface $entity, $field_n $build = array(); // Check if the user has the proper permissions. - if (!$account->hasPermission('post comments')) { + if (!$account->hasPermission('post_comments')) { drupal_set_message($this->t('You are not authorized to post comments.'), 'error'); return new RedirectResponse($uri->toString()); } @@ -217,7 +217,7 @@ public function getReplyForm(Request $request, EntityInterface $entity, $field_n // $pid indicates that this is a reply to a comment. if ($pid) { // Check if the user has the proper permissions. - if (!$account->hasPermission('access comments')) { + if (!$account->hasPermission('access_comments')) { drupal_set_message($this->t('You are not authorized to view comments.'), 'error'); return new RedirectResponse($uri->toString()); } diff --git a/core/modules/comment/src/Entity/Comment.php b/core/modules/comment/src/Entity/Comment.php index 57c7287..8cf5571 100644 --- a/core/modules/comment/src/Entity/Comment.php +++ b/core/modules/comment/src/Entity/Comment.php @@ -68,7 +68,7 @@ public function preSave(EntityStorageInterface $storage) { parent::preSave($storage); if (is_null($this->get('status')->value)) { - $published = \Drupal::currentUser()->hasPermission('skip comment approval') ? CommentInterface::PUBLISHED : CommentInterface::NOT_PUBLISHED; + $published = \Drupal::currentUser()->hasPermission('skip_comment_approval') ? CommentInterface::PUBLISHED : CommentInterface::NOT_PUBLISHED; $this->setPublished($published); } if ($this->isNew()) { diff --git a/core/modules/comment/src/Entity/CommentType.php b/core/modules/comment/src/Entity/CommentType.php index 3a1b3a8..19a2333 100644 --- a/core/modules/comment/src/Entity/CommentType.php +++ b/core/modules/comment/src/Entity/CommentType.php @@ -26,7 +26,7 @@ * }, * "list_builder" = "Drupal\comment\CommentTypeListBuilder" * }, - * admin_permission = "administer comment types", + * admin_permission = "administer_comment_types", * config_prefix = "type", * bundle_of = "comment", * entity_keys = { diff --git a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php index 02c3107..74f1a37 100644 --- a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php +++ b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php @@ -157,12 +157,12 @@ public function viewElements(FieldItemListInterface $items) { // Unpublished comments are not included in // $entity->get($field_name)->comment_count, but unpublished comments // should display if the user is an administrator. - if ($this->currentUser->hasPermission('access comments') || $this->currentUser->hasPermission('administer comments')) { + if ($this->currentUser->hasPermission('access_comments') || $this->currentUser->hasPermission('administer_comments')) { // This is a listing of Comment entities, so associate its list cache // tag for correct invalidation. $output['comments']['#cache']['tags'] = $this->entityManager->getDefinition('comment')->getListCacheTags(); - if ($entity->get($field_name)->comment_count || $this->currentUser->hasPermission('administer comments')) { + if ($entity->get($field_name)->comment_count || $this->currentUser->hasPermission('administer_comments')) { $mode = $comment_settings['default_mode']; $comments_per_page = $comment_settings['per_page']; $comments = $this->storage->loadThread($entity, $field_name, $mode, $comments_per_page, $this->getSetting('pager_id')); @@ -182,7 +182,7 @@ public function viewElements(FieldItemListInterface $items) { // display below the entity. Do not show the form for the print view mode. if ($status == CommentItemInterface::OPEN && $comment_settings['form_location'] == CommentItemInterface::FORM_BELOW && $this->viewMode != 'print') { // Only show the add comment form if the user has permission. - if ($this->currentUser->hasPermission('post comments')) { + if ($this->currentUser->hasPermission('post_comments')) { // All users in the "anonymous" role can use the same form: it is fine // for this form to be stored in the render cache. if ($this->currentUser->isAnonymous()) { diff --git a/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php b/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php index 93274a5..900d3de 100644 --- a/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php +++ b/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php @@ -138,7 +138,7 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { COMMENT_ANONYMOUS_MAY_CONTACT => t('Anonymous posters may leave their contact information'), COMMENT_ANONYMOUS_MUST_CONTACT => t('Anonymous posters must leave their contact information'), ), - '#access' => $anonymous_user->hasPermission('post comments'), + '#access' => $anonymous_user->hasPermission('post_comments'), ); $element['comment']['form_location'] = array( '#type' => 'checkbox', diff --git a/core/modules/comment/src/Plugin/entity_reference/selection/CommentSelection.php b/core/modules/comment/src/Plugin/entity_reference/selection/CommentSelection.php index b6f63a0..043795c 100644 --- a/core/modules/comment/src/Plugin/entity_reference/selection/CommentSelection.php +++ b/core/modules/comment/src/Plugin/entity_reference/selection/CommentSelection.php @@ -33,7 +33,7 @@ public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') { // Adding the 'comment_access' tag is sadly insufficient for comments: // core requires us to also know about the concept of 'published' and // 'unpublished'. - if (!\Drupal::currentUser()->hasPermission('administer comments')) { + if (!\Drupal::currentUser()->hasPermission('administer_comments')) { $query->condition('status', CommentInterface::PUBLISHED); } return $query; diff --git a/core/modules/comment/src/Plugin/views/field/LinkApprove.php b/core/modules/comment/src/Plugin/views/field/LinkApprove.php index 095eacd..985992f 100644 --- a/core/modules/comment/src/Plugin/views/field/LinkApprove.php +++ b/core/modules/comment/src/Plugin/views/field/LinkApprove.php @@ -24,8 +24,8 @@ class LinkApprove extends Link { * {@inheritdoc} */ public function access(AccountInterface $account) { - //needs permission to administer comments in general - return $account->hasPermission('administer comments'); + //needs permission to administer_comments in general + return $account->hasPermission('administer_comments'); } /** diff --git a/core/modules/comment/src/Plugin/views/field/LinkDelete.php b/core/modules/comment/src/Plugin/views/field/LinkDelete.php index f22563b..6b0b141 100644 --- a/core/modules/comment/src/Plugin/views/field/LinkDelete.php +++ b/core/modules/comment/src/Plugin/views/field/LinkDelete.php @@ -23,8 +23,8 @@ class LinkDelete extends Link { * {@inheritdoc} */ public function access(AccountInterface $account) { - //needs permission to administer comments in general - return $account->hasPermission('administer comments'); + //needs permission to administer_comments in general + return $account->hasPermission('administer_comments'); } /** diff --git a/core/modules/comment/src/Plugin/views/field/LinkReply.php b/core/modules/comment/src/Plugin/views/field/LinkReply.php index d9f6914..7e6030a 100644 --- a/core/modules/comment/src/Plugin/views/field/LinkReply.php +++ b/core/modules/comment/src/Plugin/views/field/LinkReply.php @@ -24,7 +24,7 @@ class LinkReply extends Link { */ public function access(AccountInterface $account) { //check for permission to reply to comments - return $account->hasPermission('post comments'); + return $account->hasPermission('post_comments'); } /** diff --git a/core/modules/comment/src/Tests/CommentAdminTest.php b/core/modules/comment/src/Tests/CommentAdminTest.php index 811dfde..eaa1d27 100644 --- a/core/modules/comment/src/Tests/CommentAdminTest.php +++ b/core/modules/comment/src/Tests/CommentAdminTest.php @@ -19,9 +19,9 @@ class CommentAdminTest extends CommentTestBase { function testApprovalAdminInterface() { // Set anonymous comments to require approval. user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments' => TRUE, - 'post comments' => TRUE, - 'skip comment approval' => FALSE, + 'access_comments' => TRUE, + 'post_comments' => TRUE, + 'skip_comment_approval' => FALSE, )); $this->drupalLogin($this->admin_user); $this->setCommentAnonymous('0'); // Ensure that doesn't require contact info. @@ -101,9 +101,9 @@ function testApprovalAdminInterface() { function testApprovalNodeInterface() { // Set anonymous comments to require approval. user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments' => TRUE, - 'post comments' => TRUE, - 'skip comment approval' => FALSE, + 'access_comments' => TRUE, + 'post_comments' => TRUE, + 'skip_comment_approval' => FALSE, )); $this->drupalLogin($this->admin_user); $this->setCommentAnonymous('0'); // Ensure that doesn't require contact info. diff --git a/core/modules/comment/src/Tests/CommentAnonymousTest.php b/core/modules/comment/src/Tests/CommentAnonymousTest.php index da4b453..ff70a0c 100644 --- a/core/modules/comment/src/Tests/CommentAnonymousTest.php +++ b/core/modules/comment/src/Tests/CommentAnonymousTest.php @@ -19,14 +19,14 @@ protected function setUp() { // Enable anonymous and authenticated user comments. user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments', - 'post comments', - 'skip comment approval', + 'access_comments', + 'post_comments', + 'skip_comment_approval', )); user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array( - 'access comments', - 'post comments', - 'skip comment approval', + 'access_comments', + 'post_comments', + 'skip_comment_approval', )); } @@ -116,9 +116,9 @@ function testAnonymous() { // Reset. user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments' => FALSE, - 'post comments' => FALSE, - 'skip comment approval' => FALSE, + 'access_comments' => FALSE, + 'post_comments' => FALSE, + 'skip_comment_approval' => FALSE, )); // Attempt to view comments while disallowed. @@ -135,9 +135,9 @@ function testAnonymous() { $this->assertNoFieldByName('comment_body[0][value]', '', 'Comment field not found.'); user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments' => TRUE, - 'post comments' => FALSE, - 'skip comment approval' => FALSE, + 'access_comments' => TRUE, + 'post_comments' => FALSE, + 'skip_comment_approval' => FALSE, )); $this->drupalGet('node/' . $this->node->id()); $this->assertPattern('@]*>Comments@', 'Comments were displayed.'); @@ -145,9 +145,9 @@ function testAnonymous() { $this->assertLink('register', 1, 'Link to register was found.'); user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments' => FALSE, - 'post comments' => TRUE, - 'skip comment approval' => TRUE, + 'access_comments' => FALSE, + 'post_comments' => TRUE, + 'skip_comment_approval' => TRUE, )); $this->drupalGet('node/' . $this->node->id()); $this->assertNoPattern('@]*>Comments@', 'Comments were not displayed.'); diff --git a/core/modules/comment/src/Tests/CommentBlockTest.php b/core/modules/comment/src/Tests/CommentBlockTest.php index c9b1c2d..54f16d7 100644 --- a/core/modules/comment/src/Tests/CommentBlockTest.php +++ b/core/modules/comment/src/Tests/CommentBlockTest.php @@ -27,11 +27,11 @@ protected function setUp() { // Update admin user to have the 'administer_blocks' permission. $this->admin_user = $this->drupalCreateUser(array( 'administer content types', - 'administer comments', - 'skip comment approval', - 'post comments', - 'access comments', - 'access content', + 'administer_comments', + 'skip_comment_approval', + 'post_comments', + 'access_comments', + 'access_content', 'administer_blocks', )); } @@ -54,15 +54,15 @@ function testRecentCommentBlock() { $comments[$i]->save(); } - // Test that a user without the 'access comments' permission cannot see the + // Test that a user without the 'access_comments' permission cannot see the // block. $this->drupalLogout(); - user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access comments')); + user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access_comments')); $this->drupalGet(''); $this->assertNoText(t('Recent comments')); - user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access comments')); + user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access_comments')); - // Test that a user with the 'access comments' permission can see the + // Test that a user with the 'access_comments' permission can see the // block. $this->drupalLogin($this->web_user); $this->drupalGet(''); diff --git a/core/modules/comment/src/Tests/CommentBookTest.php b/core/modules/comment/src/Tests/CommentBookTest.php index d94d0d1..ba08a06 100644 --- a/core/modules/comment/src/Tests/CommentBookTest.php +++ b/core/modules/comment/src/Tests/CommentBookTest.php @@ -55,7 +55,7 @@ public function testBookCommentPrint() { )); $comment->save(); - $commenting_user = $this->drupalCreateUser(array('access_printer-friendly_version', 'access comments', 'post comments')); + $commenting_user = $this->drupalCreateUser(array('access_printer-friendly_version', 'access_comments', 'post_comments')); $this->drupalLogin($commenting_user); $this->drupalGet('node/' . $book_node->id()); diff --git a/core/modules/comment/src/Tests/CommentCSSTest.php b/core/modules/comment/src/Tests/CommentCSSTest.php index 770502b..4a70940 100644 --- a/core/modules/comment/src/Tests/CommentCSSTest.php +++ b/core/modules/comment/src/Tests/CommentCSSTest.php @@ -22,7 +22,7 @@ protected function setUp() { // Allow anonymous users to see comments. user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments', + 'access_comments', 'access content' )); } diff --git a/core/modules/comment/src/Tests/CommentCacheTagsTest.php b/core/modules/comment/src/Tests/CommentCacheTagsTest.php index 5da5555..b850198 100644 --- a/core/modules/comment/src/Tests/CommentCacheTagsTest.php +++ b/core/modules/comment/src/Tests/CommentCacheTagsTest.php @@ -34,7 +34,7 @@ protected function setUp() { // Give anonymous users permission to view comments, so that we can verify // the cache tags of cached versions of comment pages. $user_role = Role::load(DRUPAL_ANONYMOUS_RID); - $user_role->grantPermission('access comments'); + $user_role->grantPermission('access_comments'); $user_role->save(); } diff --git a/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php b/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php index 8747737f2d..f75f0a5 100644 --- a/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php +++ b/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php @@ -33,10 +33,10 @@ protected function setUp() { parent::setUp(); // Set the current user to one that can access comments. Specifically, this - // user does not have access to the 'administer comments' permission, to + // user does not have access to the 'administer_comments' permission, to // ensure only published comments are visible to the end user. $current_user = $this->container->get('current_user'); - $current_user->setAccount($this->createUser(array(), array('access comments'))); + $current_user->setAccount($this->createUser(array(), array('access_comments'))); // Install tables and config needed to render comments. $this->installSchema('comment', array('comment_entity_statistics')); diff --git a/core/modules/comment/src/Tests/CommentFieldAccessTest.php b/core/modules/comment/src/Tests/CommentFieldAccessTest.php index ebeada1..55184ec 100644 --- a/core/modules/comment/src/Tests/CommentFieldAccessTest.php +++ b/core/modules/comment/src/Tests/CommentFieldAccessTest.php @@ -32,7 +32,7 @@ class CommentFieldAccessTest extends EntityUnitTestBase { public static $modules = array('comment', 'entity_test', 'user'); /** - * Fields that only users with administer comments permissions can change. + * Fields that only users with administer_comments permissions can change. * * @var array */ @@ -102,28 +102,28 @@ public function testAccessToAdministrativeFields() { // An administrator user. No user exists yet, ensure that the first user // does not have UID 1. $comment_admin_user = $this->createUser(['uid' => 2, 'name' => 'admin'], [ - 'administer comments', - 'access comments', + 'administer_comments', + 'access_comments', ]); // Two comment enabled users, one with edit access. $comment_enabled_user = $this->createUser(['name' => 'enabled'], [ - 'post comments', - 'skip comment approval', - 'edit own comments', - 'access comments', + 'post_comments', + 'skip_comment_approval', + 'edit_own_comments', + 'access_comments', ]); $comment_no_edit_user = $this->createUser(['name' => 'no edit'], [ - 'post comments', - 'skip comment approval', - 'access comments', + 'post_comments', + 'skip_comment_approval', + 'access_comments', ]); // An unprivileged user. - $comment_disabled_user = $this->createUser(['name' => 'disabled'], ['access content']); + $comment_disabled_user = $this->createUser(['name' => 'disabled'], ['access_content']); $role = Role::load(DRUPAL_ANONYMOUS_RID); - $role->grantPermission('post comments') + $role->grantPermission('post_comments') ->save(); $anonymous_user = new AnonymousUserSession(); @@ -205,13 +205,13 @@ public function testAccessToAdministrativeFields() { foreach ($permutations as $set) { $may_view = $set['comment']->{$field}->access('view', $set['user']); $may_update = $set['comment']->{$field}->access('edit', $set['user']); - $this->assertEqual($may_view, $set['user']->hasPermission('administer comments') || ($set['comment']->isPublished() && $set['user']->hasPermission('access comments')), String::format('User @user !state view field !field on comment @comment', [ + $this->assertEqual($may_view, $set['user']->hasPermission('administer_comments') || ($set['comment']->isPublished() && $set['user']->hasPermission('access_comments')), String::format('User @user !state view field !field on comment @comment', [ '@user' => $set['user']->getUsername(), '!state' => $may_update ? 'can' : 'cannot', '@comment' => $set['comment']->getSubject(), '!field' => $field, ])); - $this->assertEqual($may_update, $set['user']->hasPermission('administer comments'), String::format('User @user !state update field !field on comment @comment', [ + $this->assertEqual($may_update, $set['user']->hasPermission('administer_comments'), String::format('User @user !state update field !field on comment @comment', [ '@user' => $set['user']->getUsername(), '!state' => $may_update ? 'can' : 'cannot', '@comment' => $set['comment']->getSubject(), @@ -223,7 +223,7 @@ public function testAccessToAdministrativeFields() { // Check access to normal field. foreach ($permutations as $set) { $may_update = $set['comment']->access('update', $set['user']) && $set['comment']->subject->access('edit', $set['user']); - $this->assertEqual($may_update, $set['user']->hasPermission('administer comments') || ($set['user']->hasPermission('edit own comments') && $set['user']->id() == $set['comment']->getOwnerId()), String::format('User @user !state update field subject on comment @comment', [ + $this->assertEqual($may_update, $set['user']->hasPermission('administer_comments') || ($set['user']->hasPermission('edit_own_comments') && $set['user']->id() == $set['comment']->getOwnerId()), String::format('User @user !state update field subject on comment @comment', [ '@user' => $set['user']->getUsername(), '!state' => $may_update ? 'can' : 'cannot', '@comment' => $set['comment']->getSubject(), @@ -236,8 +236,8 @@ public function testAccessToAdministrativeFields() { foreach ($permutations as $set) { $may_view = $set['comment']->{$field}->access('view', $set['user']); $may_update = $set['comment']->{$field}->access('edit', $set['user']); - $this->assertEqual($may_view, $field != 'hostname' && ($set['user']->hasPermission('administer comments') || - ($set['comment']->isPublished() && $set['user']->hasPermission('access comments'))), String::format('User @user !state view field !field on comment @comment', [ + $this->assertEqual($may_view, $field != 'hostname' && ($set['user']->hasPermission('administer_comments') || + ($set['comment']->isPublished() && $set['user']->hasPermission('access_comments'))), String::format('User @user !state view field !field on comment @comment', [ '@user' => $set['user']->getUsername(), '!state' => $may_view ? 'can' : 'cannot', '@comment' => $set['comment']->getSubject(), @@ -258,12 +258,12 @@ public function testAccessToAdministrativeFields() { foreach ($permutations as $set) { $may_update = $set['comment']->{$field}->access('edit', $set['user']); // To edit the 'mail' or 'name' field, either the user has the - // "administer comments" permissions or the user is anonymous and + // "administer_comments" permissions or the user is anonymous and // adding a new comment using a field that allows contact details. - $this->assertEqual($may_update, $set['user']->hasPermission('administer comments') || ( + $this->assertEqual($may_update, $set['user']->hasPermission('administer_comments') || ( $set['user']->isAnonymous() && $set['comment']->isNew() && - $set['user']->hasPermission('post comments') && + $set['user']->hasPermission('post_comments') && $set['comment']->getFieldName() != 'comment_other' ), String::format('User @user !state update field !field on comment @comment', [ '@user' => $set['user']->getUsername(), @@ -276,7 +276,7 @@ public function testAccessToAdministrativeFields() { foreach ($permutations as $set) { // Check no view-access to mail field for other than admin. $may_view = $set['comment']->mail->access('view', $set['user']); - $this->assertEqual($may_view, $set['user']->hasPermission('administer comments')); + $this->assertEqual($may_view, $set['user']->hasPermission('administer_comments')); } } diff --git a/core/modules/comment/src/Tests/CommentFieldsTest.php b/core/modules/comment/src/Tests/CommentFieldsTest.php index bec1f5a..1f2531f 100644 --- a/core/modules/comment/src/Tests/CommentFieldsTest.php +++ b/core/modules/comment/src/Tests/CommentFieldsTest.php @@ -139,7 +139,7 @@ function testCommentInstallAfterContentModule() { // Try to post a comment on each node. A failure will be triggered if the // comment body is missing on one of these forms, due to postComment() // asserting that the body is actually posted correctly. - $this->web_user = $this->drupalCreateUser(array('access content', 'access comments', 'post comments', 'skip comment approval')); + $this->web_user = $this->drupalCreateUser(array('access content', 'access_comments', 'post_comments', 'skip_comment_approval')); $this->drupalLogin($this->web_user); $this->postComment($book_node, $this->randomMachineName(), $this->randomMachineName()); } diff --git a/core/modules/comment/src/Tests/CommentInterfaceTest.php b/core/modules/comment/src/Tests/CommentInterfaceTest.php index b174492..273b822 100644 --- a/core/modules/comment/src/Tests/CommentInterfaceTest.php +++ b/core/modules/comment/src/Tests/CommentInterfaceTest.php @@ -52,7 +52,7 @@ function testCommentInterface() { // Comment as anonymous with preview required. $this->drupalLogout(); - user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content', 'access comments', 'post comments', 'skip comment approval')); + user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content', 'access_comments', 'post_comments', 'skip_comment_approval')); $anonymous_comment = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE); $this->assertTrue($this->commentExists($anonymous_comment), 'Comment found.'); $anonymous_comment->delete(); diff --git a/core/modules/comment/src/Tests/CommentLanguageTest.php b/core/modules/comment/src/Tests/CommentLanguageTest.php index 746aea4..90e8456 100644 --- a/core/modules/comment/src/Tests/CommentLanguageTest.php +++ b/core/modules/comment/src/Tests/CommentLanguageTest.php @@ -36,7 +36,7 @@ protected function setUp() { $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); // Create and login user. - $admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer languages', 'access administration pages', 'administer content types', 'administer comments', 'create article content', 'access comments', 'post comments', 'skip comment approval')); + $admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer languages', 'access administration pages', 'administer content types', 'administer_comments', 'create article content', 'access_comments', 'post_comments', 'skip_comment_approval')); $this->drupalLogin($admin_user); // Add language. diff --git a/core/modules/comment/src/Tests/CommentLinksTest.php b/core/modules/comment/src/Tests/CommentLinksTest.php index 34b8b41..ab8940c 100644 --- a/core/modules/comment/src/Tests/CommentLinksTest.php +++ b/core/modules/comment/src/Tests/CommentLinksTest.php @@ -83,10 +83,10 @@ public function testCommentLinks() { // Change user permissions. $perms = array( - 'access comments' => 1, - 'post comments' => 1, - 'skip comment approval' => 1, - 'edit own comments' => 1, + 'access_comments' => 1, + 'post_comments' => 1, + 'skip_comment_approval' => 1, + 'edit_own_comments' => 1, ); user_role_change_permissions(DRUPAL_ANONYMOUS_RID, $perms); diff --git a/core/modules/comment/src/Tests/CommentNodeAccessTest.php b/core/modules/comment/src/Tests/CommentNodeAccessTest.php index 4c50180..bbcadcb 100644 --- a/core/modules/comment/src/Tests/CommentNodeAccessTest.php +++ b/core/modules/comment/src/Tests/CommentNodeAccessTest.php @@ -33,12 +33,12 @@ protected function setUp() { // Re-create user. $this->web_user = $this->drupalCreateUser(array( - 'access comments', - 'post comments', + 'access_comments', + 'post_comments', 'create article content', - 'edit own comments', + 'edit_own_comments', 'node test view', - 'skip comment approval', + 'skip_comment_approval', )); // Set the author of the created node to the web_user uid. diff --git a/core/modules/comment/src/Tests/CommentNonNodeTest.php b/core/modules/comment/src/Tests/CommentNonNodeTest.php index 15eb7b7..0522344 100644 --- a/core/modules/comment/src/Tests/CommentNonNodeTest.php +++ b/core/modules/comment/src/Tests/CommentNonNodeTest.php @@ -50,24 +50,24 @@ protected function setUp() { // Create test user. $this->admin_user = $this->drupalCreateUser(array( - 'administer comments', - 'skip comment approval', - 'post comments', - 'access comments', + 'administer_comments', + 'skip_comment_approval', + 'post_comments', + 'access_comments', 'view test entity', - 'administer entity_test content', + 'administer_entity_test_content', )); // Enable anonymous and authenticated user comments. user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments', - 'post comments', - 'skip comment approval', + 'access_comments', + 'post_comments', + 'skip_comment_approval', )); user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array( - 'access comments', - 'post comments', - 'skip comment approval', + 'access_comments', + 'post_comments', + 'skip_comment_approval', )); // Create a test entity. @@ -280,7 +280,7 @@ function testCommentFunctionality() { // Check that entity access applies to administrative page. $this->assertText($this->entity->label(), 'Name of commented account found.'); $limited_user = $this->drupalCreateUser(array( - 'administer comments', + 'administer_comments', )); $this->drupalLogin($limited_user); $this->drupalGet('admin/content/comment'); @@ -290,9 +290,9 @@ function testCommentFunctionality() { // Deny anonymous users access to comments. user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments' => FALSE, - 'post comments' => FALSE, - 'skip comment approval' => FALSE, + 'access_comments' => FALSE, + 'post_comments' => FALSE, + 'skip_comment_approval' => FALSE, 'view test entity' => TRUE, )); @@ -308,10 +308,10 @@ function testCommentFunctionality() { $this->assertNoFieldByName('comment_body[0][value]', '', 'Comment field not found.'); user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments' => TRUE, - 'post comments' => FALSE, + 'access_comments' => TRUE, + 'post_comments' => FALSE, 'view test entity' => TRUE, - 'skip comment approval' => FALSE, + 'skip_comment_approval' => FALSE, )); $this->drupalGet('entity_test/' . $this->entity->id()); $this->assertPattern('@]*>Comments@', 'Comments were displayed.'); @@ -324,9 +324,9 @@ function testCommentFunctionality() { // comments, to ensure that access to post comments doesn't grant access to // view them. user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments' => FALSE, - 'post comments' => TRUE, - 'skip comment approval' => TRUE, + 'access_comments' => FALSE, + 'post_comments' => TRUE, + 'skip_comment_approval' => TRUE, 'view test entity' => TRUE, )); $this->drupalGet('entity_test/' . $this->entity->id()); diff --git a/core/modules/comment/src/Tests/CommentPreviewTest.php b/core/modules/comment/src/Tests/CommentPreviewTest.php index 8d188c3..d6cbbcd 100644 --- a/core/modules/comment/src/Tests/CommentPreviewTest.php +++ b/core/modules/comment/src/Tests/CommentPreviewTest.php @@ -74,7 +74,7 @@ function testCommentPreview() { * Tests comment edit, preview, and save. */ function testCommentEditPreviewSave() { - $web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'skip comment approval', 'edit own comments')); + $web_user = $this->drupalCreateUser(array('access_comments', 'post_comments', 'skip_comment_approval', 'edit_own_comments')); $this->drupalLogin($this->admin_user); $this->setCommentPreview(DRUPAL_OPTIONAL); $this->setCommentForm(TRUE); diff --git a/core/modules/comment/src/Tests/CommentStatisticsTest.php b/core/modules/comment/src/Tests/CommentStatisticsTest.php index 6b7bf01..d36dce4 100644 --- a/core/modules/comment/src/Tests/CommentStatisticsTest.php +++ b/core/modules/comment/src/Tests/CommentStatisticsTest.php @@ -22,12 +22,11 @@ protected function setUp() { // Create a second user to post comments. $this->web_user2 = $this->drupalCreateUser(array( - 'post comments', + 'post_comments', 'create article content', - 'edit own comments', - 'post comments', - 'skip comment approval', - 'access comments', + 'edit_own_comments', + 'skip_comment_approval', + 'access_comments', 'access content', )); } @@ -66,9 +65,9 @@ function testCommentNodeCommentStatistics() { // Prepare for anonymous comment submission (comment approval enabled). $this->drupalLogin($this->admin_user); user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments' => TRUE, - 'post comments' => TRUE, - 'skip comment approval' => FALSE, + 'access_comments' => TRUE, + 'post_comments' => TRUE, + 'skip_comment_approval' => FALSE, )); // Ensure that the poster can leave some contact info. $this->setCommentAnonymous('1'); @@ -89,9 +88,9 @@ function testCommentNodeCommentStatistics() { // Prepare for anonymous comment submission (no approval required). $this->drupalLogin($this->admin_user); user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments' => TRUE, - 'post comments' => TRUE, - 'skip comment approval' => TRUE, + 'access_comments' => TRUE, + 'post_comments' => TRUE, + 'skip_comment_approval' => TRUE, )); $this->drupalLogout(); diff --git a/core/modules/comment/src/Tests/CommentTestBase.php b/core/modules/comment/src/Tests/CommentTestBase.php index d86e3d4..d1b98d4 100644 --- a/core/modules/comment/src/Tests/CommentTestBase.php +++ b/core/modules/comment/src/Tests/CommentTestBase.php @@ -60,21 +60,21 @@ protected function setUp() { // Create two test users. $this->admin_user = $this->drupalCreateUser(array( 'administer content types', - 'administer comments', - 'administer comment types', + 'administer_comments', + 'administer_comment_types', 'administer comment fields', 'administer comment display', - 'skip comment approval', - 'post comments', - 'access comments', + 'skip_comment_approval', + 'post_comments', + 'access_comments', 'access content', )); $this->web_user = $this->drupalCreateUser(array( - 'access comments', - 'post comments', + 'access_comments', + 'post_comments', 'create article content', - 'edit own comments', - 'skip comment approval', + 'edit_own_comments', + 'skip_comment_approval', 'access content', )); diff --git a/core/modules/comment/src/Tests/CommentTranslationUITest.php b/core/modules/comment/src/Tests/CommentTranslationUITest.php index 14ea0db..d2390d2 100644 --- a/core/modules/comment/src/Tests/CommentTranslationUITest.php +++ b/core/modules/comment/src/Tests/CommentTranslationUITest.php @@ -60,7 +60,7 @@ function setupBundle() { * Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::getTranslatorPermission(). */ protected function getTranslatorPermissions() { - return array_merge(parent::getTranslatorPermissions(), array('post comments', 'administer comments', 'access comments')); + return array_merge(parent::getTranslatorPermissions(), array('post_comments', 'administer_comments', 'access_comments')); } /** @@ -117,7 +117,7 @@ protected function getNewEntityValues($langcode) { protected function assertPublishedStatus() { parent::assertPublishedStatus(); $entity = entity_load($this->entityTypeId, $this->entityId); - $user = $this->drupalCreateUser(array('access comments')); + $user = $this->drupalCreateUser(array('access_comments')); $this->drupalLogin($user); $languages = $this->container->get('language_manager')->getLanguages(); @@ -143,7 +143,7 @@ protected function assertPublishedStatus() { * Tests translate link on comment content admin page. */ function testTranslateLinkCommentAdminPage() { - $this->admin_user = $this->drupalCreateUser(array_merge(parent::getTranslatorPermissions(), array('access administration pages', 'administer comments', 'skip comment approval'))); + $this->admin_user = $this->drupalCreateUser(array_merge(parent::getTranslatorPermissions(), array('access administration pages', 'administer_comments', 'skip_comment_approval'))); $this->drupalLogin($this->admin_user); $cid_translatable = $this->createEntity(array(), $this->langcodes[0]); diff --git a/core/modules/comment/src/Tests/CommentTypeTest.php b/core/modules/comment/src/Tests/CommentTypeTest.php index 4a6d1b1..e8d1fe9 100644 --- a/core/modules/comment/src/Tests/CommentTypeTest.php +++ b/core/modules/comment/src/Tests/CommentTypeTest.php @@ -33,9 +33,9 @@ class CommentTypeTest extends CommentTestBase { * @var array */ protected $permissions = array( - 'administer comments', + 'administer_comments', 'administer comment fields', - 'administer comment types', + 'administer comment_types', ); /** diff --git a/core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php b/core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php index e848ceb..66bf44e 100644 --- a/core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php +++ b/core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php @@ -38,7 +38,7 @@ class CommentFieldFilterTest extends CommentTestBase { function setUp() { parent::setUp(); - $this->drupalLogin($this->drupalCreateUser(['access comments'])); + $this->drupalLogin($this->drupalCreateUser(['access_comments'])); // Add two new languages. ConfigurableLanguage::createFromLangcode('fr')->save(); diff --git a/core/modules/comment/src/Tests/Views/CommentTestBase.php b/core/modules/comment/src/Tests/Views/CommentTestBase.php index 06500bc..460386b 100644 --- a/core/modules/comment/src/Tests/Views/CommentTestBase.php +++ b/core/modules/comment/src/Tests/Views/CommentTestBase.php @@ -36,7 +36,7 @@ protected function setUp() { // Add two users, create a node with the user1 as author and another node // with user2 as author. For the second node add a comment from user1. - $this->account = $this->drupalCreateUser(array('skip comment approval')); + $this->account = $this->drupalCreateUser(array('skip_comment_approval')); $this->account2 = $this->drupalCreateUser(); $this->drupalLogin($this->account); diff --git a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php index fdcb8f5..1350712 100644 --- a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php +++ b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php @@ -91,11 +91,11 @@ protected function setUp() { * @param array $context * Context for the links. * @param bool $has_access_comments - * TRUE if the user has 'access comments' permission. + * TRUE if the user has 'access_comments' permission. * @param bool $history_exists * TRUE if the history module exists. * @param bool $has_post_comments - * TRUE if the use has 'post comments' permission. + * TRUE if the use has 'post_comments' permission. * @param bool $is_anonymous * TRUE if the user is anonymous. * @param array $expected @@ -114,8 +114,8 @@ public function testCommentLinkBuilder(NodeInterface $node, $context, $has_acces $this->currentUser->expects($this->any()) ->method('hasPermission') ->willReturnMap(array( - array('access comments', $has_access_comments), - array('post comments', $has_post_comments), + array('access_comments', $has_access_comments), + array('post_comments', $has_post_comments), )); $this->currentUser->expects($this->any()) ->method('isAuthenticated') diff --git a/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php index 98ea255..bb9a400 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php @@ -37,7 +37,7 @@ protected function setUp() { $this->container->get('comment.manager')->addDefaultField('node', 'article', 'comment_article', CommentItemInterface::OPEN, 'comment_article'); $this->container->get('comment.manager')->addDefaultField('node', 'page', 'comment_page'); - $admin_user = $this->drupalCreateUser(array('access administration pages', 'administer languages', 'administer content translation', 'administer content types', 'administer node fields', 'administer comment fields', 'administer comments', 'administer comment types', 'administer account settings')); + $admin_user = $this->drupalCreateUser(array('access administration pages', 'administer languages', 'administer content translation', 'administer content types', 'administer node fields', 'administer comment fields', 'administer_comments', 'administer_comment_types', 'administer account settings')); $this->drupalLogin($admin_user); } diff --git a/core/modules/content_translation/src/Tests/ContentTranslationStandardFieldsTest.php b/core/modules/content_translation/src/Tests/ContentTranslationStandardFieldsTest.php index 1b0cd31..1244fb8 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationStandardFieldsTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationStandardFieldsTest.php @@ -48,8 +48,8 @@ protected function setUp() { 'administer content types', 'administer node fields', 'administer comment fields', - 'administer comments', - 'administer comment types', + 'administer_comments', + 'administer_comment_types', )); $this->drupalLogin($admin_user); } diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceSelectionAccessTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceSelectionAccessTest.php index a6edb35..34ebc24 100644 --- a/core/modules/entity_reference/src/Tests/EntityReferenceSelectionAccessTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceSelectionAccessTest.php @@ -438,7 +438,7 @@ public function testCommentHandler() { } // Test as a non-admin. - $normal_user = $this->drupalCreateUser(array('access content', 'access comments')); + $normal_user = $this->drupalCreateUser(array('access content', 'access_comments')); \Drupal::currentUser()->setAccount($normal_user); $referenceable_tests = array( array( @@ -477,7 +477,7 @@ public function testCommentHandler() { $this->assertReferenceable($field, $referenceable_tests, 'Comment handler'); // Test as a comment admin. - $admin_user = $this->drupalCreateUser(array('access content', 'access comments', 'administer comments')); + $admin_user = $this->drupalCreateUser(array('access content', 'access_comments', 'administer_comments')); \Drupal::currentUser()->setAccount($admin_user); $referenceable_tests = array( array( @@ -495,7 +495,7 @@ public function testCommentHandler() { $this->assertReferenceable($field, $referenceable_tests, 'Comment handler (comment admin)'); // Test as a node and comment admin. - $admin_user = $this->drupalCreateUser(array('access content', 'access comments', 'administer comments', 'bypass node access')); + $admin_user = $this->drupalCreateUser(array('access content', 'access_comments', 'administer_comments', 'bypass node access')); \Drupal::currentUser()->setAccount($admin_user); $referenceable_tests = array( array( diff --git a/core/modules/file/src/Tests/FileFieldWidgetTest.php b/core/modules/file/src/Tests/FileFieldWidgetTest.php index 5cc7ab7..f3b988a 100644 --- a/core/modules/file/src/Tests/FileFieldWidgetTest.php +++ b/core/modules/file/src/Tests/FileFieldWidgetTest.php @@ -237,16 +237,16 @@ function testPrivateFileSetting() { * Tests that download restrictions on private files work on comments. */ function testPrivateFileComment() { - $user = $this->drupalCreateUser(array('access comments')); + $user = $this->drupalCreateUser(array('access_comments')); // Grant the admin user required comment permissions. $roles = $this->admin_user->getRoles(); - user_role_grant_permissions($roles[1], array('administer comment fields', 'administer comments')); + user_role_grant_permissions($roles[1], array('administer comment fields', 'administer_comments')); // Revoke access comments permission from anon user, grant post to // authenticated. - user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access comments')); - user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('post comments', 'skip comment approval')); + user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access_comments')); + user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('post_comments', 'skip_comment_approval')); // Create a new field. $this->container->get('comment.manager')->addDefaultField('node', 'article'); diff --git a/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php b/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php index 99d82d3..3d09849 100644 --- a/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php +++ b/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php @@ -51,9 +51,9 @@ protected function setUp() { // Setup users. $this->web_user = $this->drupalCreateUser(array( 'access content', - 'access comments', - 'post comments', - 'skip comment approval', + 'access_comments', + 'post_comments', + 'skip_comment_approval', $filtered_html_format->getPermissionName(), )); $this->drupalLogin($this->web_user); diff --git a/core/modules/forum/src/Tests/ForumBlockTest.php b/core/modules/forum/src/Tests/ForumBlockTest.php index a58182b..4b66e80 100644 --- a/core/modules/forum/src/Tests/ForumBlockTest.php +++ b/core/modules/forum/src/Tests/ForumBlockTest.php @@ -38,8 +38,8 @@ protected function setUp() { 'administer_blocks', 'administer nodes', 'create forum content', - 'post comments', - 'skip comment approval', + 'post_comments', + 'skip_comment_approval', )); } diff --git a/core/modules/forum/src/Tests/ForumTest.php b/core/modules/forum/src/Tests/ForumTest.php index c7cb0ad..46d133b 100644 --- a/core/modules/forum/src/Tests/ForumTest.php +++ b/core/modules/forum/src/Tests/ForumTest.php @@ -78,7 +78,7 @@ protected function setUp() { 'administer menu', 'administer taxonomy', 'create forum content', - 'access comments', + 'access_comments', )); $this->edit_any_topics_user = $this->drupalCreateUser(array( 'access administration pages', @@ -95,9 +95,9 @@ protected function setUp() { $this->post_comment_user = $this->drupalCreateUser(array( 'administer content types', 'create forum content', - 'post comments', - 'skip comment approval', - 'access comments', + 'post_comments', + 'skip_comment_approval', + 'access_comments', )); $this->drupalPlaceBlock('system_help_block', array('region' => 'help')); } @@ -176,7 +176,7 @@ function testForum() { $this->assertFieldByXPath($xpath, '6', 'Number of posts found.'); // Test loading multiple forum nodes on the front page. - $this->drupalLogin($this->drupalCreateUser(array('administer content types', 'create forum content', 'post comments'))); + $this->drupalLogin($this->drupalCreateUser(array('administer content types', 'create forum content', 'post_comments'))); $this->drupalPostForm('admin/structure/types/manage/forum', array('options[promote]' => 'promote'), t('Save content type')); $this->createForumTopic($this->forum, FALSE); $this->createForumTopic($this->forum, FALSE); diff --git a/core/modules/forum/src/Tests/Views/ForumIntegrationTest.php b/core/modules/forum/src/Tests/Views/ForumIntegrationTest.php index de169f6..6ea58b9 100644 --- a/core/modules/forum/src/Tests/Views/ForumIntegrationTest.php +++ b/core/modules/forum/src/Tests/Views/ForumIntegrationTest.php @@ -57,7 +57,7 @@ public function testForumIntegration() { $nodes[] = $node; } - $account = $this->drupalCreateUser(array('skip comment approval')); + $account = $this->drupalCreateUser(array('skip_comment_approval')); $this->drupalLogin($account); $comments = array(); diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_role.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_role.yml index f899c8a..61f3590 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_role.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_role.yml @@ -25,7 +25,7 @@ process: map: 'use PHP for block visibility': 'use PHP for settings' 'administer site-wide contact form': 'administer contact forms' - 'post comments without approval': 'skip comment approval' + 'post comments without approval': 'skip_comment_approval' 'edit own blog entries' : 'edit own blog content' 'edit any blog entry' : 'edit any blog content' 'delete own blog entries' : 'delete own blog content' diff --git a/core/modules/migrate_drupal/src/Tests/Dump/Drupal6UserRole.php b/core/modules/migrate_drupal/src/Tests/Dump/Drupal6UserRole.php index 41f5abe..3ee0dca 100644 --- a/core/modules/migrate_drupal/src/Tests/Dump/Drupal6UserRole.php +++ b/core/modules/migrate_drupal/src/Tests/Dump/Drupal6UserRole.php @@ -110,7 +110,7 @@ public static function getData($table) { array('pid' => 1, 'rid' => 1, 'perm' => 'migrate test anonymous permission'), array('pid' => 2, 'rid' => 2, 'perm' => 'migrate test authenticated permission'), array('pid' => 3, 'rid' => 3, 'perm' => 'migrate test role 1 test permission'), - array('pid' => 4, 'rid' => 4, 'perm' => 'migrate test role 2 test permission, use PHP for settings, administer contact forms, skip comment approval, edit own blog content, edit any blog content, delete own blog content, delete any blog content, create forum content, delete any forum content, delete own forum content, edit any forum content, edit own forum content, administer nodes'), + array('pid' => 4, 'rid' => 4, 'perm' => 'migrate test role 2 test permission, use PHP for settings, administer contact forms, skip_comment_approval, edit own blog content, edit any blog content, delete own blog content, delete any blog content, create forum content, delete any forum content, delete own forum content, edit any forum content, edit own forum content, administer nodes'), ), 'role' => array( array('rid' => 1, 'name' => 'anonymous user'), diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserRoleTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserRoleTest.php index ec08766..359bb33 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserRoleTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserRoleTest.php @@ -77,7 +77,7 @@ public function testUserRole() { 'migrate test role 2 test permission', 'use PHP for settings', 'administer contact forms', - 'skip comment approval', + 'skip_comment_approval', 'edit own blog content', 'edit any blog content', 'delete own blog content', diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/RoleTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/RoleTest.php index 8211e49..89338ad 100644 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/RoleTest.php +++ b/core/modules/migrate_drupal/tests/src/Unit/source/d6/RoleTest.php @@ -45,9 +45,9 @@ class RoleTest extends MigrateSqlSourceTestCase { 'rid' => 2, 'name' => 'authenticated user', 'permissions' => array( - 'access comments', + 'access_comments', 'access content', - 'post comments', + 'post_comments', 'post comments without approval', ), ), @@ -55,9 +55,9 @@ class RoleTest extends MigrateSqlSourceTestCase { 'rid' => 3, 'name' => 'administrator', 'permissions' => array( - 'access comments', - 'administer comments', - 'post comments', + 'access_comments', + 'administer_comments', + 'post_comments', 'post comments without approval', 'access content', 'administer content types', diff --git a/core/modules/node/src/Tests/NodeAccessPagerTest.php b/core/modules/node/src/Tests/NodeAccessPagerTest.php index af4140f..dbc8e0d 100644 --- a/core/modules/node/src/Tests/NodeAccessPagerTest.php +++ b/core/modules/node/src/Tests/NodeAccessPagerTest.php @@ -30,7 +30,7 @@ protected function setUp() { node_access_rebuild(); $this->drupalCreateContentType(array('type' => 'page', 'name' => t('Basic page'))); $this->container->get('comment.manager')->addDefaultField('node', 'page'); - $this->web_user = $this->drupalCreateUser(array('access content', 'access comments', 'node test view')); + $this->web_user = $this->drupalCreateUser(array('access content', 'access_comments', 'node test view')); } /** diff --git a/core/modules/node/src/Tests/NodeTitleTest.php b/core/modules/node/src/Tests/NodeTitleTest.php index d692be5..441232d 100644 --- a/core/modules/node/src/Tests/NodeTitleTest.php +++ b/core/modules/node/src/Tests/NodeTitleTest.php @@ -26,7 +26,7 @@ class NodeTitleTest extends NodeTestBase { protected function setUp() { parent::setUp(); - $this->admin_user = $this->drupalCreateUser(array('administer nodes', 'create article content', 'create page content', 'post comments')); + $this->admin_user = $this->drupalCreateUser(array('administer nodes', 'create article content', 'create page content', 'post_comments')); $this->drupalLogin($this->admin_user); $this->container->get('comment.manager')->addDefaultField('node', 'page'); } diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index c3fce4f..9ce6f64 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -313,7 +313,7 @@ function rdf_preprocess_node(&$variables) { } // Adds RDFa markup annotating the number of comments a node has. - if (\Drupal::moduleHandler()->moduleExists('comment') && \Drupal::currentUser()->hasPermission('access comments')) { + if (\Drupal::moduleHandler()->moduleExists('comment') && \Drupal::currentUser()->hasPermission('access_comments')) { $comment_count_mapping = $mapping->getPreparedFieldMapping('comment_count'); if (!empty($comment_count_mapping['properties'])) { $fields = array_keys(\Drupal::service('comment.manager')->getFields('node')); diff --git a/core/modules/rdf/src/Tests/CommentAttributesTest.php b/core/modules/rdf/src/Tests/CommentAttributesTest.php index 69a5966..e12050d 100644 --- a/core/modules/rdf/src/Tests/CommentAttributesTest.php +++ b/core/modules/rdf/src/Tests/CommentAttributesTest.php @@ -30,9 +30,9 @@ protected function setUp() { // Enables anonymous user comments. user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( - 'access comments' => TRUE, - 'post comments' => TRUE, - 'skip comment approval' => TRUE, + 'access_comments' => TRUE, + 'post_comments' => TRUE, + 'skip_comment_approval' => TRUE, )); // Allows anonymous to leave their contact information. $this->setCommentAnonymous(COMMENT_ANONYMOUS_MAY_CONTACT); diff --git a/core/modules/rdf/src/Tests/StandardProfileTest.php b/core/modules/rdf/src/Tests/StandardProfileTest.php index 29e9804..bd57858 100644 --- a/core/modules/rdf/src/Tests/StandardProfileTest.php +++ b/core/modules/rdf/src/Tests/StandardProfileTest.php @@ -109,14 +109,14 @@ protected function setUp() { // Create two test users. $this->adminUser = $this->drupalCreateUser(array( 'administer content types', - 'administer comments', - 'access comments', + 'administer_comments', + 'access_comments', 'access content', )); $this->webUser = $this->drupalCreateUser(array( - 'access comments', - 'post comments', - 'skip comment approval', + 'access_comments', + 'post_comments', + 'skip_comment_approval', 'access content', )); diff --git a/core/modules/search/src/Tests/SearchCommentCountToggleTest.php b/core/modules/search/src/Tests/SearchCommentCountToggleTest.php index 10d7cf1..bb20219 100644 --- a/core/modules/search/src/Tests/SearchCommentCountToggleTest.php +++ b/core/modules/search/src/Tests/SearchCommentCountToggleTest.php @@ -37,7 +37,7 @@ protected function setUp() { parent::setUp(); // Create searching user. - $this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'post comments', 'skip comment approval')); + $this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access_comments', 'post_comments', 'skip_comment_approval')); // Login with sufficient privileges. $this->drupalLogin($this->searching_user); diff --git a/core/modules/search/src/Tests/SearchCommentTest.php b/core/modules/search/src/Tests/SearchCommentTest.php index 9fb3938..a4f685c 100644 --- a/core/modules/search/src/Tests/SearchCommentTest.php +++ b/core/modules/search/src/Tests/SearchCommentTest.php @@ -45,9 +45,9 @@ protected function setUp() { $full_html_format->getPermissionName(), 'administer permissions', 'create page content', - 'post comments', - 'skip comment approval', - 'access comments', + 'post_comments', + 'skip_comment_approval', + 'access_comments', ); $this->admin_user = $this->drupalCreateUser($permissions); $this->drupalLogin($this->admin_user); @@ -81,8 +81,8 @@ function testSearchResultsComment() { // Allow anonymous users to search content. $edit = array( DRUPAL_ANONYMOUS_RID . '[search content]' => 1, - DRUPAL_ANONYMOUS_RID . '[access comments]' => 1, - DRUPAL_ANONYMOUS_RID . '[post comments]' => 1, + DRUPAL_ANONYMOUS_RID . '[access_comments]' => 1, + DRUPAL_ANONYMOUS_RID . '[post_comments]' => 1, ); $this->drupalPostForm('admin/people/permissions', $edit, t('Save permissions')); @@ -201,7 +201,7 @@ function testSearchResultsCommentAccess() { */ function setRolePermissions($rid, $access_comments = FALSE, $search_content = TRUE) { $permissions = array( - 'access comments' => $access_comments, + 'access_comments' => $access_comments, 'search content' => $search_content, ); user_role_change_permissions($rid, $permissions); @@ -247,8 +247,8 @@ function testAddNewComment() { 'search content', 'create article content', 'access content', - 'post comments', - 'access comments', + 'post_comments', + 'access_comments', )); $this->drupalLogin($user); diff --git a/core/modules/search/src/Tests/SearchKeywordsConditionsTest.php b/core/modules/search/src/Tests/SearchKeywordsConditionsTest.php index 789687f..7200646 100644 --- a/core/modules/search/src/Tests/SearchKeywordsConditionsTest.php +++ b/core/modules/search/src/Tests/SearchKeywordsConditionsTest.php @@ -29,7 +29,7 @@ protected function setUp() { parent::setUp(); // Create searching user. - $this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'skip comment approval')); + $this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access_comments', 'skip_comment_approval')); // Login with sufficient privileges. $this->drupalLogin($this->searching_user); } diff --git a/core/modules/search/src/Tests/SearchRankingTest.php b/core/modules/search/src/Tests/SearchRankingTest.php index 669e6c4..7094672 100644 --- a/core/modules/search/src/Tests/SearchRankingTest.php +++ b/core/modules/search/src/Tests/SearchRankingTest.php @@ -38,7 +38,7 @@ protected function setUp() { $this->nodeSearch = entity_load('search_page', 'node_search'); // Login with sufficient privileges. - $this->drupalLogin($this->drupalCreateUser(array('post comments', 'skip comment approval', 'create page content', 'administer search'))); + $this->drupalLogin($this->drupalCreateUser(array('post_comments', 'skip_comment_approval', 'create page content', 'administer search'))); } public function testRankings() { diff --git a/core/modules/system/core.api.php b/core/modules/system/core.api.php index 5983876..d8f9670 100644 --- a/core/modules/system/core.api.php +++ b/core/modules/system/core.api.php @@ -594,7 +594,7 @@ * permissions to them. Here's an example: * @code * $role = \Drupal\user\Entity\Role::load('authenticated'); - * $role->grantPermission('access comments'); + * $role->grantPermission('access_comments'); * $role->save(); * @endcode * diff --git a/core/modules/system/tests/upgrade/drupal-7.field_ui.database.php b/core/modules/system/tests/upgrade/drupal-7.field_ui.database.php index 1487f8b..fdef041 100644 --- a/core/modules/system/tests/upgrade/drupal-7.field_ui.database.php +++ b/core/modules/system/tests/upgrade/drupal-7.field_ui.database.php @@ -38,7 +38,7 @@ )) ->values(array( 'rid' => '5', - 'permission' => 'administer comments', + 'permission' => 'administer_comments', 'module' => 'comment', )) ->values(array( diff --git a/core/modules/system/tests/upgrade/drupal-7.roles.database.php b/core/modules/system/tests/upgrade/drupal-7.roles.database.php index ab84595..b875e8e 100644 --- a/core/modules/system/tests/upgrade/drupal-7.roles.database.php +++ b/core/modules/system/tests/upgrade/drupal-7.roles.database.php @@ -43,7 +43,7 @@ )) ->values(array( 'rid' => '4', - 'permission' => 'edit own comments', + 'permission' => 'edit_own_comments', 'module' => 'comment', )) ->execute(); diff --git a/core/modules/tracker/src/Tests/TrackerTest.php b/core/modules/tracker/src/Tests/TrackerTest.php index d1896fb..42218bb 100644 --- a/core/modules/tracker/src/Tests/TrackerTest.php +++ b/core/modules/tracker/src/Tests/TrackerTest.php @@ -43,7 +43,7 @@ protected function setUp() { $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); - $permissions = array('access comments', 'create page content', 'post comments', 'skip comment approval'); + $permissions = array('access_comments', 'create page content', 'post_comments', 'skip_comment_approval'); $this->user = $this->drupalCreateUser($permissions); $this->other_user = $this->drupalCreateUser($permissions); $this->container->get('comment.manager')->addDefaultField('node', 'page'); @@ -117,7 +117,7 @@ function testTrackerUser() { $this->assertTitle(t('@name | @site', array('@name' => $this->user->getUsername(), '@site' => \Drupal::config('system.site')->get('name'))), 'The user tracker page has the correct page title.'); // Verify that unpublished comments are removed from the tracker. - $admin_user = $this->drupalCreateUser(array('post comments', 'administer comments', 'access user profiles')); + $admin_user = $this->drupalCreateUser(array('post_comments', 'administer_comments', 'access user profiles')); $this->drupalLogin($admin_user); $this->drupalPostForm('comment/1/edit', array('status' => CommentInterface::NOT_PUBLISHED), t('Save')); $this->drupalGet('user/' . $this->user->id() . '/activity'); diff --git a/core/modules/tracker/src/Tests/Views/TrackerTestBase.php b/core/modules/tracker/src/Tests/Views/TrackerTestBase.php index 4b69d9c..14f1a4f 100644 --- a/core/modules/tracker/src/Tests/Views/TrackerTestBase.php +++ b/core/modules/tracker/src/Tests/Views/TrackerTestBase.php @@ -39,7 +39,7 @@ protected function setUp() { // Add a comment field. $this->container->get('comment.manager')->addDefaultField('node', 'page'); - $permissions = array('access comments', 'create page content', 'post comments', 'skip comment approval'); + $permissions = array('access_comments', 'create page content', 'post_comments', 'skip_comment_approval'); $account = $this->drupalCreateUser($permissions); $this->drupalLogin($account); diff --git a/core/modules/user/src/Tests/UserCancelTest.php b/core/modules/user/src/Tests/UserCancelTest.php index de3d1ae..77dba5c 100644 --- a/core/modules/user/src/Tests/UserCancelTest.php +++ b/core/modules/user/src/Tests/UserCancelTest.php @@ -304,7 +304,7 @@ function testUserDelete() { $this->container->get('comment.manager')->addDefaultField('node', 'page'); // Create a user. - $account = $this->drupalCreateUser(array('cancel account', 'post comments', 'skip comment approval')); + $account = $this->drupalCreateUser(array('cancel account', 'post_comments', 'skip_comment_approval')); $this->drupalLogin($account); // Load real user object. $account = user_load($account->id(), TRUE); diff --git a/core/modules/user/src/Tests/UserPictureTest.php b/core/modules/user/src/Tests/UserPictureTest.php index 639c382..a101f26 100644 --- a/core/modules/user/src/Tests/UserPictureTest.php +++ b/core/modules/user/src/Tests/UserPictureTest.php @@ -35,9 +35,9 @@ protected function setUp() { $this->web_user = $this->drupalCreateUser(array( 'access content', - 'access comments', - 'post comments', - 'skip comment approval', + 'access_comments', + 'post_comments', + 'skip_comment_approval', )); } diff --git a/core/modules/user/src/Tests/UserSignatureTest.php b/core/modules/user/src/Tests/UserSignatureTest.php index 1eb9af7..f16f592 100644 --- a/core/modules/user/src/Tests/UserSignatureTest.php +++ b/core/modules/user/src/Tests/UserSignatureTest.php @@ -60,9 +60,9 @@ protected function setUp() { user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array($this->filtered_html_format->getPermissionName())); // Create regular and administrative users. - $this->web_user = $this->drupalCreateUser(array('post comments')); + $this->web_user = $this->drupalCreateUser(array('post_comments')); - $admin_permissions = array('post comments', 'administer comments', 'administer user form display', 'administer account settings'); + $admin_permissions = array('post_comments', 'administer_comments', 'administer user form display', 'administer account settings'); foreach (filter_formats() as $format) { if ($permission = $format->getPermissionName()) { $admin_permissions[] = $permission; diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 40032e9..a8c2f7b 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1209,7 +1209,7 @@ function user_role_load($rid) { * 'administer_blocks' => FALSE, // Revoke 'administer_blocks' * 'access user profiles' => 1, // Grant 'access user profiles' * 'access content' => TRUE, // Grant 'access content' - * 'access comments' => 'access comments', // Grant 'access comments' + * 'access_comments' => 'access_comments', // Grant 'access_comments' * ) * @endcode * Existing permissions are not changed, unless specified in $permissions. diff --git a/core/profiles/standard/src/Tests/StandardTest.php b/core/profiles/standard/src/Tests/StandardTest.php index fc49685..2c5fa0f 100644 --- a/core/profiles/standard/src/Tests/StandardTest.php +++ b/core/profiles/standard/src/Tests/StandardTest.php @@ -34,8 +34,8 @@ function testStandard() { // Test anonymous user can access 'Main navigation' block. $admin = $this->drupalCreateUser(array( 'administer_blocks', - 'post comments', - 'skip comment approval', + 'post_comments', + 'skip_comment_approval', )); $this->drupalLogin($admin); // Configure the block. diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install index c2b5582..12c133f 100644 --- a/core/profiles/standard/standard.install +++ b/core/profiles/standard/standard.install @@ -36,8 +36,8 @@ function standard_install() { $user_settings->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save(); // Enable default permissions for system roles. - user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access comments')); - user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access comments', 'post comments', 'skip comment approval')); + user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access_comments')); + user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access_comments', 'post_comments', 'skip_comment_approval')); // Enable all permissions for the administrator role. user_role_grant_permissions('administrator', array_keys(\Drupal::service('user.permissions')->getPermissions()));