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.
I'm trying to use the Editablefields module with a field on a flagging and it doesn't work because Flagging entities don't have standard entity permissions - particularly for the 'update' action. I realise this is because flag permissions are handled separately from the standard permissions system, allowing, e.g., admins to specify that users can flag or not flag their own nodes, but would it be possible to include these standard entity permissions?
Comments
Comment #1
joachim CreditAttribution: joachim commentedDoes Editablefields use Entity API's entity_access()?
We could probably implement that callback, and interpret the $op that receives in terms of the Flag permissions.
Comment #2
bsarchive CreditAttribution: bsarchive commentedYes, it does. The access test looks like this:
This is covered in an issue in the editablefields queue: https://www.drupal.org/node/2103023
Comment #3
joachim CreditAttribution: joachim commentedOk, so:
- implement the access callback for the Flagging entity
- in the callback, load the $flag handler for the flagging entity, and use its access method. The translation from $op is probably: create -> flag, delete -> unflag, update -> flag, view -> flag
Comment #4
bsarchive CreditAttribution: bsarchive commentedSorry - you've lost me. Could you explain what you mean?
Comment #5
joachim CreditAttribution: joachim commented1. Declare the access callback in our hook_entity_info().
2. Implement the callback, say, flagging_entity_access():