0

I know about user_access API. I've written a module that should display some information only if the user has specific rights on the taxonomy.

To be more precise:

  • we've created a vocabulary, say books.
  • in this vocabulary books we have a lot of terms, say for example children and cooking
  • we've created roles according to the terms, i.e. roles like role for children and role for cooking => one role = one term.
  • now I've written a module that should diplay a link to 'edit' or 'create' only if the user is logged, and if he has the rights based on the role (which heavily relies on the taxonomy access rights).

In short: in my node_view hook:

  • I have to check if it's a node with books vocabulary.
  • if so, I have to read the associated term (there can be only one), let's take an example: children
  • if the user is logged in and has the permissions of editing nodes with the specific term (children here), the I display a text with a link like edit this book and another like like create a children's book.

This is only the last part that is a problem to me.

Does the user access API call works flawlessly, and takes in account those rights, or do I have some specific calls to do? No API seems available for the taxonomy access control (TAC).

Maybe you have an example somewhere (didn't find one actually)?

1

Are you actually having a problem with user_access or just asking before you're trying it? I'm not really following what exactly is your problem.

Taxonomy Access Control should influence what user_access returns. Or you could just set permissions for "Use contextual links" and let Drupal take care of it with contextual links instead of writing a custom module.

  • I'm having a problem with user_access because it doesn't go "deep" enough for permissions, and I need to know whether user has rights to edit/create plus the rights to edit create the specific node regarding its terms and the rights given to the user through the api taxonomy access rights – Olivier Pons Dec 19 '12 at 16:01
  • Sorry I didn't read carefully the notes at the bottom of the TAC module. Now it works. I write your answer as the good one. Thank you. – Olivier Pons Dec 21 '12 at 15:07
  • Glad you solved it. – Beebee Dec 21 '12 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.