Comments

internetdevels’s picture

Status: Active » Needs review
StatusFileSize
new859 bytes

Here is the patch.

Status: Needs review » Needs work

The last submitted patch, drupal-contextual_replace_user_access-2061979.patch, failed testing.

andypost’s picture

+++ b/core/modules/contextual/contextual.module
@@ -23,7 +23,8 @@ function contextual_menu() {
+  $account = Drupal::request()->attributes->get('_account');

@@ -61,7 +62,8 @@ function contextual_toolbar() {
+  $account = Drupal::request()->attributes->get('_account');

Use Drupal::currentUser() service https://drupal.org/node/2032447

michaelhiiva’s picture

Status: Needs work » Needs review
StatusFileSize
new859 bytes
new831 bytes
michaelhiiva’s picture

StatusFileSize
new831 bytes
new813 bytes

Provided wrong patch in #4.

andypost’s picture

  1. +++ b/core/modules/contextual/contextual.module
    @@ -23,7 +23,8 @@ function contextual_menu() {
    +  $account = \Drupal::currentUser();
    
    @@ -61,7 +62,9 @@ function contextual_toolbar() {
    +  $account = \Drupal::currentUser();
    

    the '\' is not needed in procedural code

  2. +++ b/core/modules/contextual/contextual.module
    @@ -23,7 +23,8 @@ function contextual_menu() {
    +  if (!$account->hasPermission('access contextual links')) {
    
    @@ -61,7 +62,9 @@ function contextual_toolbar() {
    +  if (!$account->hasPermission('access contextual links')) {
    

    Drupal::currentUser()->hasPermission() is enough

michaelhiiva’s picture

StatusFileSize
new913 bytes
new765 bytes

@andypost Thanks for the information.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Great!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.