Hello

There's a module, Taxonomy Access Fix, which besides other things, adds a permission to add terms to a vocabulary (in contrast to Edit and Delete terms), and in short, having it installed, allows admins to give add + edit + delete terms permissions per vocabulary, instead of giving administer taxonomy permission.

When we have taxonomy access fix enabled and remove that administer taxonomy permission from users, when they are adding new references in the edit forms, they are presented with the Edit button, but not the Add button.

Please add support for it by integrating with Taxonomy Access Fix when it's present.
note: it's a per vocabulary Add term permission, just like Edit/Delete term.

http://drupal.org/project/taxonomy_access_fix

Comments

andypost’s picture

lpalgarvio’s picture

I'm using References Dialog with Entity Reference
http://drupal.org/project/entityreference

i've also created an issue at Drupal Core
#1839604: Add taxonomy term permission

k_zoltan’s picture

StatusFileSize
new1.44 KB

This patch should do the work when working with taxonomy_access_fix and the reference_dialog module.
Its a quick solution and it could have been done better, bot that would require also some changes in the
taxonomy_access_fix_access function too.

rudiedirkx’s picture

Your patch uses entity_access(), but this module doesn't have entity.module as a dependency... What am I missing?

gilsbert’s picture

Status: Active » Reviewed & tested by the community

Hi.

The last dev version is not compatible with the suggested patch #3.

For the last dev version we can use the following patch:

[edited] file: references_dialog/references_dialog.dialog_widgets.inc [/edited]

@@ -280,6 +280,15 @@
$access = node_access('create', $bundle);
break;

+ case 'taxonomy_term':
+ if (function_exists('taxonomy_access_fix_access')) {
+ $vocabulary = taxonomy_vocabulary_machine_name_load($bundle);
+ $access = taxonomy_access_fix_access('add terms', $vocabulary);
+ } else {
+ $access = entity_access('create', $entity_type);
+ }
+ break;
+
default:
$access = entity_access('create', $entity_type);
break;

I'm also changing the status for RTBC trying to get maintainers attention.

P.S.: I stil dont know how to properly write a patch file and I apologize for this.

Regards,
Gilsberty

rudiedirkx’s picture

If you want to know how to patch: https://drupal.org/node/707484 you'll need git.

I'm not sure why I'm following this issue. Bye =)

gilsbert’s picture

Version: 7.x-1.0-alpha4 » 7.x-1.x-dev
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new786 bytes

Hi.

Thank you very much for guiding to the correct place to learn about patches.

I'm sending a suggested patch to integrate "references_dialog" with "taxonomy_access_fix".

I tested on my environment with 100% success.

Regards,
Gilsberty

[edited] The patch works for the last dev version. [/edited]

sanderleyandrade’s picture

I applied patch #7 and it is working perfectly.

WorldFallz’s picture

Issue summary: View changes
Status: Needs review » Needs work

I like this functionality and the patch, but none of the involved modules have entity as a dependency so entity_access to should be replaced with non-entity dependent code.

WorldFallz’s picture

actually, entity_access is all over references_dialog so it seems rd has an undeclared dependency on it.

WorldFallz’s picture

Actually, this method and these patches no longer work at all with the current dev. Here's a patch that works and no longer requires entity_access. Will be committed to the current dev shortly.

WorldFallz’s picture

And I'm surprised there isn't a bug report for it, but the module currently also ties edit access for term references to the "administer taxonomy" perm rather than the edit perm. Here's an updated patch the fixes both.

  • WorldFallz committed abc331c on 7.x-1.x
    Issue #1819752 by WorldFallz, gilsbert, k_zoltan: Integrate with...
WorldFallz’s picture

Status: Needs work » Fixed

fixed.

  • WorldFallz committed 1905e0f on 7.x-1.x authored by gilsbert
    Issue #1819752 by WorldFallz, gilsbert: Integrate with Taxonomy Access...
WorldFallz’s picture

Now i get it. #7 was for er fields as opposed to term ref fields. Committed it substituting module_exists() for function_exists(). And entity_access dependency is not an issue since er already has entity as a dependency.

This should now be working properly for both er and tr field types.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.