Needs review
Project:
Contact Storage
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
13 May 2016 at 06:07 UTC
Updated:
17 Oct 2024 at 15:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
larowlanComment #3
larowlanComment #4
berdir+1 to submodule. Should possibly be a setting per form (to be protected or not) and default to public, similar to how field permissions work, otherwise it's always complicated to add new forms.
entity.contact_form.canonical route uses contact_form.view entity access, so we can hook into that easily.
Comment #5
larowlanAgree
These two are related too.
Given this is a sub-module, those would be part of the main module.
This one would need to work with them so I'm guessing a sub controller or an alter hook.
#2724507: Add a maximum submission limit for forms
#2724499: Allow disabling forms to prevent new submissions
Comment #6
naveenvalechaI have worked on the implementation of this functionality.
https://www.drupal.org/sandbox/naveenvalecha/2725179
Following items are done :
Pending action items :
Comment #7
naveenvalechaHere it goes the test with following features in patch :
Pending :
Questions :
Do we need a separate Readme.txt for the sub module ?
Comment #8
naveenvalecha.
Comment #9
larowlanThanks @naveenvalecha, looking good - a few comments/observations
Could we instead say 'Provides the ability to add a new permission to each contact form to limit access' or something. Not really to do with personal contact form.
I think just listing contact_storage is enough
nit - two .
I think we should add a
#descriptionhere to explain what this options does. Something like 'Require a unique permission to access this form'nit: no newline
We could defer this to the parent implementation
nit: permission *to* administer
Can we
assertResponse(200)after thisnit: newline
Comment #10
naveenvalecha#9.1 Done
#9.2 Done
#9.3 Done
#9.4 Done
#9.5 Done
#9.7 Done
#9.8 Done
#9.9 Done
Comment #11
berdirthis is already in the parent, doesn't need to be duplicated.
If don't really like overriding the access control handler. Online one module can do this, whenever possible, we should work with the access hooks.
That means for this, we need to do a allow or forbidden, not allowedIf().
Comment #12
jibranPatch looks good to me. @naveenvalecha can you please address #10 so that we can move forward here.
Comment #13
naveenvalechaAccommodated #11
//Naveen
Comment #14
naveenvalechaHere's the correct inter diff.
//Naveen
Comment #16
naveenvalechaHere's the green patch.
Running the WTB on local is damn slow. Filed the task #2886713: Convert Tests to BTB from WTB to convert the tests to BTB
Comment #17
jibranOver to @berdir
Comment #18
naveenvalechaThis landed #2886713: Convert Tests to BTB from WTB
Here's the updated patch. New test is damn fast compared to before.
Comment #19
foolfitz commentedExcuse me, personal contact form has no options page, how to set the 'protect' option to it?
Thank you for the great job.
Comment #20
hannessDid anyone looked at the module Contact Message Permissions?
It claims to be An extension of the core contact module that provides form-by-form permissions to access (edit/view/delete) message entities generated by these forms.
Comment #21
matt_paz commentedNot sure if this patch will ever make it in, but if so, D9 compatibility should be added to contact_permissions.info.yml
Comment #22
larowlanwe also need to switch the permissions route provider from
EntityPermissionsRouteProviderWithChecktoEntityPermissionsRouteProviderThis needs to use \Drupal\Core\Entity\BundlePermissionHandlerTrait now so that we get the correct dependencies
Comment #25
majorrobot commentedThis seems like a good feature to replace the Contact Form Permissions module (which appears abandoned and doesn't have a supported release anymore). So I'm excited to see it in progress!
I've created a fork/MR from @naveenvalecha's patch in #18 and updated core version requirements.
I've also attempted to address @larowlan's requests in #22.
I've added this, as I understand it -- but this is my first time handling permissions in Drupal 8+, so I may have missed something.
I'm actually not following this one -- I don't see where
EntityPermissionsRouteProviderWithCheckis used. Nor have I been able to figure out the intent of the note with a little research. Happy to make changes if someone could clarify, though.