Based on the change record https://www.drupal.org/node/2049309 user_access function calls needs to be changed to \Drupal::currentUser()->hasPermission()

Comments

gokulnk’s picture

Providing a patch with the changes.

jaak’s picture

Simplytest.me says after enabling admin_menu module:

Fatal error: Call to undefined function current_path() in /home/se1b3739babe1cf5/www/sites/default/modules/admin_menu/admin_menu.module on line 153

HongPong’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
4.59 KB
None View

This applies cleanly against current HEAD and seems to be essential to moving forward. @jaak to prevent the current_path() fatal error the path core module must be enabled. This has been noted on #2563867: PHP Fatal errors: Cannot instantiate interface Drupal\Core\Cache\CacheBackendInterface and others and also attached here is a re roll that fixes this fatal. I think it is RTBC so we can unravel some other fatal errors on other fronts.

Dave Reid’s picture

Status: Reviewed & tested by the community » Needs work

FYI in D8 code you should always be using "\Drupal" and not just "Drupal" to indicate you're using the root namespace class. Also, you shouldn't RTBC your own patch, others should be doing that and reviewing & testing your patches.

HongPong’s picture

Ugh I am really sorry about that, I got overcaffeinated and a bit frenzied from the fatals. Won't happen again :[

Andrew.Mikhailov’s picture

Hello guys!
I corrected this patch, but I see you have many work with this module.
You didn't port variables, menu, config of module and etc.
Can I help you? I have enough time for contribute.
Best regards.

Status: Needs review » Needs work

The last submitted patch, 6: change_user_access_calls-2457801-7-6.patch, failed testing.

Andrew.Mikhailov’s picture

Status: Needs work » Needs review

Sorry don't understand what's problem...
I applied patch via git for last module version and for me it was correct.
Try again...

Status: Needs review » Needs work

The last submitted patch, 6: change_user_access_calls-2457801-7-6.patch, failed testing.

Andrew.Mikhailov’s picture

I've checked Drupal CI, I think problem on their side http://joxi.ru/Vrw3eBYCnMYWrX
Best regards.

Andrew.Mikhailov’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: change_user_access_calls-2457801-7-6.patch, failed testing.

loopduplicate’s picture

Status: Needs work » Needs review

Changing status back to needs review to see if the testbot is working now. This based on #10

Status: Needs review » Needs work

The last submitted patch, 6: change_user_access_calls-2457801-7-6.patch, failed testing.

The last submitted patch, 6: change_user_access_calls-2457801-7-6.patch, failed testing.

yash_khandelwal’s picture

By replacing user_access function with Drupal::currentUser()->hasPermission method, issue resolved.