Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Users who wish to view a report on what they have voted on, will not have the means to do so currently, because the default access control handler for the Vote entity will return a neutral result, which will not allow the user to view any voting data, even their own voting data.
Proposed resolution
Provide an access control handler for the Vote entity, and a few basic permissions to regulate access to viewing the Vote entity.
Remaining tasks
Review patch.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#23 | 2907696-23-access-control-handler.patch | 7.34 KB | TR |
#20 | interdiff-18-20.txt | 514 bytes | TR |
#20 | 2907696-20-access-control-handler.patch | 7.27 KB | TR |
Comments
Comment #2
mroycroft CreditAttribution: mroycroft at Workday, Inc. commentedHere is the patch, and a test is included.
Comment #3
mroycroft CreditAttribution: mroycroft at Workday, Inc. commentedComment #4
jhedstromThis patch no longer applies to the latest code.
Comment #5
pifagor@jhedstrom
Please test. I changed patch, but I didn't test it
Comment #6
pifagorComment #7
pifagorComment #8
mmjvb CreditAttribution: mmjvb as a volunteer commentedIgnore, my mistake
Comment #9
pifagorPlease test patch
Comment #10
pifagorComment #11
kevin.dutra CreditAttribution: kevin.dutra at Workday, Inc. commentedMinor reroll to address the patch failing to apply. (EOF newline issue in the permissions file)
Comment #12
rpayanmComment #13
TR CreditAttribution: TR commentedPatch in #11 still applies, and comes with a test so it can be tested!
I made only two minor changes to the patch. Specifically, in the test case, $modules should be protected and we don't need to use StringTranslationTrait or t(). Other than that everything looks good to me.
Comment #14
TR CreditAttribution: TR commentedRe-roll because #13 was using the old simpletest Trait instead of the new one. See the interdiff, it's only a change to one "use" statement.
Comment #15
TR CreditAttribution: TR commentedRe-rolled #14 against current HEAD. The only difference is in VoteAccessControlHandler.php, and the previous patch is old enough that a proper interdiff can't be made for that file.
Comment #16
TR CreditAttribution: TR commentedRearranged the switch statement to satisfy phpcs.
Comment #18
TR CreditAttribution: TR commentedStupid mistake - forgot the return.
Comment #20
TR CreditAttribution: TR commentedNot doing too well tonight - I keep missing little things. Let's see if I got it right this time:
Comment #21
jernejmramor CreditAttribution: jernejmramor at Agiledrop - Your Trusted Drupal Teammates commentedHello,
I have tested the patch from #20 and it is working for me.
Comment #22
igork96 CreditAttribution: igork96 at Agiledrop - Your Trusted Drupal Teammates commentedI gave it a view and can confirm it's working.
Comment #23
TR CreditAttribution: TR commentedRerolled the patch to add return type hints to the new test functions.