Hi everyone
I use Taxonomy Access Control Lite module in my site and it really helps me but there is a problem which is important. Let me explain the problem with an example:

I have three users in my site: user1,user2, and user3.
I also have a vocabulary named voc1 which consists of three items: item1,item2, and item3.( A user can select multiple items of voc1).
I set the permissions with Taxonomy Access Control Lite as the following:
1- user1 can view and edit contents with the taxonomy item1.
2- user2 can view and edit contents with the taxonomy item2.
3- user3 can view and edit contents with the taxonomy item1, item2, and item3.

Now we can have the following scenario:
Step1: user3 create a page and select all three items (item1, item2, and item3). So at this time, all three users (user1,user2, and user3) can view and edit the page.
Step2: user2 edits the body of the page, he/she doesn't select or deselect any item from the list of voc1(as you know he/she can only see item2 in the list of voc1).

And here is the problem: if user2 save the page, item1 and item3 will be deselected automatically. So user1 won't be able to view or edit the page.

I am new to drupal, so please inform me if I couldn't explain my problem accurately.
I really appreciate for your help and attention. :)

Comments

Dave Cohen’s picture

Category: bug » feature

I understand this problem. It's been reported in the past, and I've resolved it as "by design". What you're asking for, that tags which the user cannot see remain attached to a node, even after that user has edited the node... IMHO that would be more of a bug than the current behavior. I believe when a user submits that edit form, the content should reflect exactly what they submitted. There should not be secret tags which magically remain attached to the node.

However, I could see adding an option to each tac_lite scheme. Something like a checkbox labelled "hide all terms which user cannot view". The difference is... tac_lite will always hide nodes which the user cannot view, but we could make it optional whether tac_lite hides the terms. That is, your user would see all the terms in the node edit form, instead of what they see now, with some terms removed.

I hope I made that clear. Would that work in your case?

Farzaneh’s picture

Title: A taxonomy will be deselect from its list if a user save the page. » Tags which a user can't see don't remain attached to nodes when a the user edit nodes.

Thank you very much for your fast reply. You explain your belief and the solution clearly. ^__^
Let me explain the situation which I used this module.
I created a taxonomy to control users access to contents, so it is important that when a user view or edit a page, he/she can't see who else have permission to the page. At least a feature can be added which can specify "just the author of a page can modify the terms attached to the page" (I mean the terms which I configured to use with taxonomy access control lite).
I really need this feature and I hope you can help me.

Dave Cohen’s picture

If I understand correctly, you want the node to be editable by many users, but only the original author can change the taxonomy. That's not something I'd support in tac_lite ('lite' means simple). But you could write a small hook_form_alter to hide the taxonomy field from non-authors.

Theres still the problem of tac_lite hiding some terms from some users...

Have you looked at the tac module. It came before tac_lite. It's more complex and might have something along the lines of what you want, maybe.

Dave Cohen’s picture

Status: Active » Needs review
StatusFileSize
new2.9 KB

Here's the patch I'm considering to tac_lite.module.

With this patch applied, edit your scheme, unchecking the "term visibility" checkbox. Then tac_lite will not hide terms on the node form. And it's up to you to write your own hook_form_alter if you want to change what the user sees on that form.

Farzaneh’s picture

Title: Tags which a user can't see don't remain attached to nodes when a the user edit nodes. » Tags which a user can't see don't remain attached to nodes after the user edit nodes.

Thanks a million for your help and suggestions. :) Your help is very valuable for me.

antgiant’s picture

StatusFileSize
new2.96 KB

I made two modifications to #4.

1. I renamed "Term Visibility" "Restrict Term Visibility".
2. I made it so checking "Restrict Term Visibility" still shows the terms you can view. The previous patch caused the checkbox to always override other tac_lite visibility settings.

I also wasn't sure if these two lines were accidentally included in this patch. (I left them in.)

>               $form['tac_lite'][$config['realm']][$vid]['#description'] =
>                 t('Grant permission to this user by selecting terms.  Note that permissions are in addition to those granted based on user roles.');
antgiant’s picture

Status: Needs review » Needs work
StatusFileSize
new2.99 KB

So after further investigation I was wrong to make change number 2 (details below). Attached is an updated patch that only changes "Term Visibility" to "Restrict Term Visibility".

However, I think there is a bug in this code. We have two schemas one for viewing and a separate one for updating. Modifying the term visibility checkbox for the viewing schema appropriately changes the available terms when editing to either the limited set or the full set. However, if under the update schema I check the term visibility checkbox then when I edit a node no terms are listed at all. Not even terms that are selected on both the view and the update schemas.

soulfroys’s picture

I have this problem too...

- A node have a term selected and this term have the permission "edit/delete" (seted by TAC-Lite) for the role "members".
- User A and UserB are both "members".
- User A edit a node and did not touch anything
- User B can no longer edit.

If I give "administer tac_lite" permission to the "members" role, then the User A and User can edit it normally (obviously).

Is there anything new about it? There are some combination of schemes to solve this?

[EDITED]
I just fix (newbie) my problem whith a custom module:

/**
 * Alter a node form
 */
function [mymodule]_node_form_alter(&$form, &$form_state) {
  // Vocabulary associated in TAC Lite
  $vid = 21;
  // Get the content types associated with the vocabulary 21
  $content_types =  taxonomy_vocabulary_load($vid)->nodes;
  if (isset($form['type']) && in_array($form['type']['#value'], $content_types)) {
    $node = node_load($form['nid']['#value']);
    $terms = taxonomy_node_get_terms_by_vocabulary($node, $vid);
    foreach ($terms as $tid => $term) {
      $form['taxonomy'][$vid][$tid]['#default_value'] = $tid;
    }
  }
}

[EDITED V2]

The above code just works with Taxonomy Super Select (TSS), this works with Drupal core and TSS:

>
/**
 * Alter a node form
 */
function [mymodule]_node_form_alter(&$form, &$form_state) {
  // Vocabulary associated in TAC Lite
  $vid = 21;
  // Take the content types associated with the vocabulary 21
  $content_types =  taxonomy_vocabulary_load($vid)->nodes;
  if (isset($form['type']) && in_array($form['type']['#value'], $content_types)) {
    $node = node_load($form['nid']['#value']);
    $terms = taxonomy_node_get_terms_by_vocabulary($node, $vid);
    foreach ($terms as $tid => $term) {
      // radio/check (Taxonomy Super Select)
      $form['taxonomy'][$vid][$tid]['#default_value'] = $tid;
      // Select/list (Drupal Core)
      $form['taxonomy'][$vid]['#default_value'][] = $tid;
    }
  }
}
damienmckenna’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Thank you for your contribution to this module. Support for Drupal 6 ended a decade ago, so I'm closing out this issue.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.