Currently the entity_metadata_taxonomy_access() access callback does not respect "delete terms in {vid}" and requires users to have "administer taxonomy" in order to have access.

Modules using the entity controllers to validate delete access then fail when expecting this permission to work as expected, like when using Inline Entity Form.

Patch to follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mglaman’s picture

Attached is patch which adds check on "delete" operations and proper permissions.

andyg5000’s picture

Status: Active » Needs review
mglaman’s picture

FileSize
681 bytes

Reroll of patch. Generated through PhpStorm originally, now through Git command line.

Status: Needs review » Needs work

The last submitted patch, 3: 2288483-check-for-delete-permission-2.patch, failed testing.

The last submitted patch, 1: 2288483-check-for-delete-permission.patch, failed testing.

mglaman’s picture

Status: Needs work » Needs review
FileSize
683 bytes

Update logic in patch so patch stops failing.

amitaibu’s picture

i believe it doesn't respect "create" permissions as-well

mglaman’s picture

Terms rely on "edit" not "create" as the permission. We're using Inline Entity Form to re-work the taxonomy term management for users. We only provision the "edit" permission. We realized they could edit and add correctly, but not delete. This patch is what allows us to provide management of terms to users without giving them complete "administer terms" access.

drumm’s picture

Chris Matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 5 year old patch in #6 to callbacks.inc does not apply to the latest entity 7.x-1.x-dev and (if still relevant) needs a reroll.

Checking patch modules/callbacks.inc...
error: while searching for:
  if (isset($entity) && $op == 'update' && !isset($account) && taxonomy_term_edit_access($entity)) {
    return TRUE;
  }
  if (user_access('administer taxonomy', $account) || user_access('access content', $account) && $op == 'view') {
    return TRUE;
  }

error: patch failed: modules/callbacks.inc:801
error: modules/callbacks.inc: patch does not apply