Give permissions to a specific role to edit specific terms I have a vocabulary (Foods) with these terms.


Meet
Fruits


I want every user with the Gardner role to be able to edit the description of Fruits only. How can I do that?

This is just an example, on my site I have several terms, and I need specific users roles to edit specific term descriptions.

https://www.drupal.org/project/private_taxonomy does what I need, but I already have the taxonomy terms and I don't know how to change the ownership.
The access callback for a term edit page is taxonomy_term_edit_access($term). You need to replace it with a custom one in order to allow gardeners to access the page for fruit terms.

/**
 * Implements hook_menu_alter().
 */
function MODULE_menu_alter(&amp;$items) {
  $items['taxonomy/term/%taxonomy_term/edit']['access callback']
    = 'MODULE_term_edit_access';
}

/**
 * Access callback for taxonomy edit term page.
 */
public function MODULE_term_edit_access($term) {
  if (MODULE_term_is_fruit($term) &amp;&amp; user_access('edit fruits terms')) {
    return TRUE;
  }
  return taxonomy_term_edit_access($term);
}

/**
 * Returns whether or not a term is a fruit.
 */
function MODULE_term_is_fruit($term) {
  // ... implement fruit detection here ...
  foreach (taxonomy_get_parents_all($term-&gt;tid) as $parent) {
    if ($parent-&gt;name == 'Fruit') {
      return TRUE;
    }
  }
  return FALSE.
}

/**
 * Implement hook_permissions().
 */
function MODULE_permissions() {
  $permissions['edit fruits terms'] = array(
      'title' =&gt; t('Edit fruits terms'),
      'description' =&gt; t('Allows the user to edit Fruits terms.'),
  );
}