Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
other
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Aug 2013 at 09:12 UTC
Updated:
12 Feb 2016 at 21:41 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
internetdevels commentedPatch attached.
Comment #2
andypostUse Drupal::currentUser() service https://drupal.org/node/2032447
This will need re-roll after #1938390: Convert contact_site_page and contact_person_page to a new-style Controller
Comment #3
kim.pepperThis is the only occurrence of user_access left in the contact module.
Comment #4
andypostYep, the one one left
Comment #5
xjmThanks for your work on this!
See #2048171-17: [meta] Replace user_access() calls with $account->hasPermission() wherever possible.. Expanding the scope of this issue; please update this patch to include fixes to all modules except user.module and then confirm that no instances remain in core/modules that are not in core/modules/user before RTBCing.
Comment #6
xjmOh, and please help make sure everyone who worked on the duplicates for other core modules gets credit for this patch! Put a commit message in the summary and final RTBC comment for core maintainers.
Comment #7
kim.pepperHi Jess,
There are only 3 other issues left for this (including user module issue). 23 have already been committed.
I'm not sure how much efficiency we'll get out of combining them?
Kim
Comment #8
herom commented@kim.pepper, many other issues were left, but the remaining ones were closed as duplicate, and only 3 were left to merge all the others.
for this issue, I think these should be merged:
#2061961: Replace user_access() calls with $account->hasPermission() in content translation module
#2062041: Replace user_access() calls with $account->hasPermission() in views module
#2062037: Replace user_access() calls with $account->hasPermission() in update module
#2061993: Replace user_access() calls with $account->hasPermission() in file module
#2061995: Replace user_access() calls with $account->hasPermission() in filter module
#2061975: Replace user_access() calls with $account->hasPermission() in comment module
#2061989: Replace user_access() calls with $account->hasPermission() in field_ui module
#2062007: Replace user_access() calls with $account->hasPermission() in node module
#2062029: Replace user_access() calls with $account->hasPermission() in toolbar module
#2062025: Replace user_access() calls with $account->hasPermission() in system module
so, there were a lot of issues; but a lot of tiny issues that each one had to go through review-rtbc-reroll-patch, review-rtbc-reroll-patch, ... over and over again. makes sense to do this all once.
Comment #9
kim.pepperOK. Here's a combined patch of all those listed above.
Comment #10
andypostCompiled list of people involved from all duplicate issues #8:
Issue #2061977 by kim.pepper, InternetDevels, rhm50, naveenvalecha, andypost, mandar.harkare, sergeypavlenko, sidharthap, herom, SIz, tkuldeep17: Replace user_access() calls with $account->hasPermission() in all core modules except user.added to summary
Comment #11
andypostThis changes should be fixed in #2062043: Replace user_access() calls with $account->hasPermission() in core files
Comment #12
kim.pepperRe-roll plus remove core includes as per #11
Comment #13
andypostRTBC if green
Comment #15
herom commentednot green...
and a couple of things I noticed, that should be fixed with the next patch:
Drupal::called without "\" prefix. And no need for local variable here, you can call\Drupal::currentUser()->hasPermission()directly.Also,
!$account ||is unnecessary, since that would always be false here.this also belongs to the core files issue.
Comment #16
herom commentedfixing the tests, points in #15, and a few extra $account params.
Comment #18
herom commentedoops.
Comment #19
andypost18: 2061977-user-access-18.patch queued for re-testing.
Comment #21
herom commentedreroll.
Comment #23
herom commented21: 2061977-user-access-21.patch queued for re-testing.
Comment #25
herom commentedthe fails don't seem relevant, and are different than previous test.
doing another retest, to see what comes up.
Comment #26
herom commented21: 2061977-user-access-21.patch queued for re-testing.
Comment #27
ianthomas_ukReroll, plus replacing occurrences that have slipped in this patch. Interdiff shows the new occurrences I replaced after completing my reroll.
Comment #29
herom commentedrerolled + a one line fix.
Comment #30
herom commentedre-uploading the patch, since it didn't show up in the issue summary Files table.
Comment #31
dawehnerI think it is fine to not do injection for now.
The new way for this example is actually much nicer code!
Comment #32
webchickCommitted and pushed to 8.x. Thanks!
Comment #35
webchickSorry, that last bit was to fix commit credit. I missed the nicely formatted commit message in the issue summary because I was trying to commit patches and talk on the phone at the same time. :P Thanks to herom for the alert!
Comment #37
jthorson commentedComment #38
jthorson commented