Allow access on children items
| Project: | Taxonomy Access Control Lite |
| Version: | 5.x-1.2 |
| Component: | Documentation |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
I don't think my request is same as http://drupal.org/node/127621, however, this is the scenario:
- I have a fixed hierarchy eg. country/region/city;
- the site will have a lot of user posting content, and some users should only be allowed to post content to eg. region_A AND city_1 or just city_2. That is a user that can post content just to city 2 cannot post content to its parents;
- I have created a role that hasn't got any access to the site vocabularies AND then, for each user belonging to that role, I modify the specific permissions.
TAC LITE does block non-allowed contents, BUT it doesn't dig into hierarchy. So, if user John Doe can only edit city_2, the taxonomy select box in node/add mask remains empty. To let him see his taxonomy item in the select box, I have to grant access on all parent items, which will give the user the unwanted permission to post contents related to the top level.

#1
This will take some investigating. Tac_lite uses db_rewrite to hide terms that a user is not supposed to see. In the case of nested terms, this apparently causes trouble for the taxonomy module when it builds the tree.
I'm not even sure this is fixable. Because how should terms be displayed when a user is allowed to see a term but not it's parent?
If it is fixable, it may be a fix in core, because that is where the taxonomy tree and form element are built.
#2
Yes... in fact I believe it's just as you say. It's Taxonomy that populates the select box, not TAC lite. BTW I've worked out a solution using CCK to build a content type PERMISSION that associates the user to a list of terms. Then, I've simply put in a hidden block some php code that does the following:
1) check if records PERMISSION exist for the logged user;
2) if so, it retrieves the tids and put them in a ALLOWED_TIDS array ignoring the hierarchy tree ( as hierarchy is only required for viewing contents);
3) with the new array, I add some basic jquery code to the page that simply replace the html of the select box with a new html generated starting from the ALLOWED_TID array.
Not structural, but it completely fulfill my needs and it's open for further customization.
#3
Ref. #2: is that code shared somewhere?
#4