This originated as a spin-off of #1831578: Use file_entity_access() callback when file_entity module is present.

The patch there fails with the version of File Entity bundled with Media 1.3 (which is still the default version), because the file_entity_access function was introduced in File Entity 2.0.

Also, the explicit dependency on File Entity module seems inelegant.

The normal way of resolving an issue like this would be for the dependent module (in this case File Entity) to run after Entity API and insert its own callback - but we already put ourselves at the bottom of the list.

Patch to follow makes this more generic, allowing any module to insert its own access callback. Could be extended to the other callbacks, but I'll leave that for now since there are no issues around it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wodenx’s picture

Status: Active » Needs review
FileSize
1.19 KB
wodenx’s picture

Title: File Access not compatible with Media 1.3 » Allow modules to insert alternative access callbacks
Category: bug » feature
joachim’s picture

Issue summary: View changes

The comment would make a bit more sense to me if it said something like:

// Core entity types do not have our access callbacks. They are provided here, unless another contrib module has already done so. This must be done here since ... [as before]

But that's personal preference, so I'll leave that up to the patch author and maintainer.

Other than that, looks good :)

checker’s picture

Patch #1 looks good. But I think it should be usable for all core entities. So comment and taxonomy_term are missing. This patch is lightweight and generically enough.

I'm confused about this hard coded patch for file entity module #1831578: Use file_entity_access() callback when file_entity module is present.

checker’s picture

Patch #1 + commet, taxonomy_vocabulary, taxonomy_term

Status: Needs review » Needs work

The last submitted patch, 5: 2094833-entity-access-alternatives-2.patch, failed testing.

checker’s picture

checker’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: 2094833-entity-access-alternatives-2.patch, failed testing.

checker’s picture

checker’s picture

Status: Needs work » Closed (duplicate)