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.
Most contrib modules seem to provide configurable permissions for actions, and a client of mine had a requirement to provide more granularity as to who sees editable fields. You could theoretically provide a bunch of different view modes for the content in question, and serve them up based on some arbitrary rules, but that's a lot of work for something that should be handled by user_access().
Attached is a straightforward patch to provide a permission and test against it alongside update access for the content in question.
Comment | File | Size | Author |
---|---|---|---|
editablefields-perm.patch | 1.22 KB | bradjones1 |
Comments
Comment #1
kingdee40 CreditAttribution: kingdee40 commentedThis works well, without the need for custom hook_permission.
Just set the permissions on editablefields and on the node.
Comment #2
bradjones1@kingdee - Could you clarify, do you mean this patch is unnecessary due to existing functionality I overlooked? Right now editablefields doesn't provide any permissions, hence my adding the hook, here. Or am I misunderstanding you?
Comment #3
kingdee40 CreditAttribution: kingdee40 commentedSorry, what I meant was your patch works better then the other option http://drupal.org/node/1344634 which requires a custom hook_permission.
Comment #4
bradjones1Thanks. Feel free to mark RTBC then :-)
Comment #5
kingdee40 CreditAttribution: kingdee40 commentedI have this patch running on several dev sites, permissions are working well.
Comment #6
MGParisi CreditAttribution: MGParisi commentedTested!
Comment #7
dags CreditAttribution: dags commentedCommitted to 7.x-1.x. Thanks.
Comment #8
haegar der schreckliche CreditAttribution: haegar der schreckliche commentedUsing this patch I cannot see any editable fields in my views anymore. I am using the field_permissions module to set permissions.
Comment #9
dags CreditAttribution: dags commentedCould you please describe your content type configuration and field_permission configuration in more detail?
Comment #10
haegar der schreckliche CreditAttribution: haegar der schreckliche commentedSorry, my fault.
I should have mentioned that the "Use editablefields" permission field did not show up for me even though I cleared the caches. I still don't know why this happened.
But now one day later it suddenly appeared and everything is fine.
Comment #12
ncarty97 CreditAttribution: ncarty97 commentedI am using the alpha 2 release now and the 'Use editablefields" permission is no where to be found. I have cleared the caches.
I am using this module for a view of inventory from drupal commerce. The role I created to manage that can see the view, but the editable fields are not available to the role. Assigning a role of adminstrator to the user makes them available.
Comment #13
dags CreditAttribution: dags commentedBugs are fixed in the dev branch - it's not possible to go back and fix alpha2. Try using the dev branch.
Comment #13.0
dags CreditAttribution: dags commentedCleanup summary