Jump to:
| Project: | Taxonomy Access Control |
| Version: | 6.x-1.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Hi, i read a lot of this and I think that you are working on this, but am not sure and would like to confirm this, the case is as follows:
A user creates a node with an associated term and a user with permission to edit that term but not to create, edit and save the node that preserves've seen before but if the user has selected some term of which has permission add this term to the node, ideal, or at least in my case is that the field is hidden and not allow "add" any other terms.
I added the following code to the module and it works, but I have not tested with several vocabularies in the same node, I guess that does not distinguish whether the terms are to preserve a vocabulary or another, so that hides all.
foreach ($form['taxonomy'] as $vid => $el) {
if (is_numeric($vid) && is_array($el)) {
if(count(taxonomy_access_preserve_terms($form['#node']))>0)
$form['taxonomy'][$vid]['#access'] = FALSE;
}
}
Comments
#1
I am sorry, but I don't understand your question at all. A few guesses:
For more information, please see the TAC documentation: http://drupal.org/node/31601
If you still need support, please provide a clearer description of what you are trying to accomplish, preferably with some screenshots.
#2
Sorry for the delay.
My question is if I have a term in a node and the person who edits this node does not have permission to use it ("create") option, the taxonomy has to hide so that you can not change the term, maintaining that already have .
User1 Create node and asigned term1.
User 2 edit node and he can asign term2 but not term1 -> in this case i wan't user2 can't asign any term to node (hide taxonomy)
#3
I think I understand now. If you have a required, non-multiple vocabulary on your content type, a users who has Update but not Create permissions for an existing node's term is forced to select a different term instead, making it so that the node is tagged with two terms even though the vocabulary should not allow it. Is this a correct description of your problem?
And the solution is to patch TAC so that, if a term is already set in a single vocabulary and the user does not have create for that term, then the vocabulary is hidden entirely.
#4
Saved halfway through typing the title...
An additional problem is if user2 has Update permissions but no create permissions at all, this user still sees a "please select" box for taxonomy--one with no terms in it--and therefore cannot submit the form.
#5
#6
Right, that's the problem, Are you working in a solution? I will look at how to solve it and my provisional solution is in the post #1 .
In taxonomy_access.module
<?phpfunction taxonomy_access_form_alter(&$form, $form_state, $form_id) {
if ($form['#id'] == 'node-form' && is_numeric($form['nid']['#value'])) {
$form['tac_protected_terms'] = array(
'#type' => 'value',
'#value' => taxonomy_access_preserve_terms($form['#node'])
);
/*-------------------------------------------------------*/
* ADD
*-------------------------------------------------------*/
*/
foreach ($form['taxonomy'] as $vid => $el) {
if (is_numeric($vid) && is_array($el)) {
if(count(taxonomy_access_preserve_terms($form['#node']))>0)
$form['taxonomy'][$vid]['#access'] = FALSE;
}
}
}
/*-------------------------------------------------------*/
}
?>
#7
Well, this is related to the entire future of the create op: #903522: Move control of create into hook_form_alter() and hook_nodeapi() to prevent numerous problems. However, this is a pretty specific bug. So, I'm going to leave this issue active for now instead of marking it duplicate. I need to think about the implications a bit. Thank you for your followup!