When a user, with appropriate rights, tries to edit a term they get access denied returned after clicking the edit link. This is caused by what I think is a typo on line 517 in og_vocab.module. You are passing in $term->tid where you should be passing in $term->vid. I will submit a patch here once I have generated one.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pgillis’s picture

Title: og_vocab_determine_access fails on edit term resulting in access denied error » User with appropriate rights cannot edit term in an OG vocabulary

Updated title to something more appropriate.

pgillis’s picture

Status: Active » Needs review
FileSize
550 bytes

Attached is patch.

christefano’s picture

Issue tags: +gdolove

Tagging. This may be what we need to make OG Vocab work again on groups.drupal.org.

FatherShawn’s picture

Status: Needs review » Needs work

Upgraded a site to 1.2 and made the indicated change on line 517. Created a vocabulary (tags) in a group, vocab displays on node-id/og_vocab. Edit an existing or create new posting - vocab missing from edit form, also missing on reload of node-id/vocab. Vocab exists at /admin/content/taxonomy/list.

Rolled back patch and this behavior disappears - module functions normally.

bobmarchman’s picture

#2 worked like a charm for me. This fix needs to go in regardless because that is the appropriate argument for taxonomy_vocabulary_load(). If the patch causes a regression, then that should be fixed elsewhere, but I see no reason on the surface why this patch shouldn't go in.

christefano’s picture

FatherShawn, did you mean to change the status to "needs work"? From what you and bobmarchman are saying in your comments, the patch works as intended and should be RTBC'd. (I'm not marking it RTBC myself since I haven't tested this yet.)

netsensei’s picture

Priority: Normal » Critical
Status: Needs work » Reviewed & tested by the community

Just spent the better part of the last 2 hours hunting the same bug.

$vocab = taxonomy_vocabulary_load($term->tid);

shoud be

$vocab = taxonomy_vocabulary_load($term->vid);

Refering to the Drupal API: http://api.drupal.org/api/drupal/modules%21taxonomy%21taxonomy.module/fu... where it the first function argument should be the vocabulary ID. og_vocab passes the Term ID which causes either one of two things to happen: the passed term accidentally matches an existing vocabulary related to a totally different group then the active one, or the function always returns FALSE if there the argument doesn't match any existing vocabulary id.

I'd call this a critical one since it seriously breaks access behaviour.

Ki’s picture

FileSize
721 bytes

I think there are actually two places that need fix.

   if ($id) {
     $access = FALSE;
     if ($type == 'vocabulary') {
-      $vocab = $id;
+      $vocab = is_numeric($id) ? (object)array('vid' => $id) : $id;
     }
     else {
       // Load the term, to get its vocabulary ID.
       $term = taxonomy_get_term($id);
-      $vocab = taxonomy_vocabulary_load($term->tid);
+      $vocab = taxonomy_vocabulary_load($term->vid);
     }
     // Make sure vocabulary ID belongs to the group node.
     if ($group = og_vocab_get_group($vocab->vid)) {
       $access = $node->nid == $group['nid'];
     }
   }

Edit: Code above is revised and attachment can be ignored. I could not drop it in edit mode.

capellic’s picture

I solved this problem on my own and then I found this case and came to the same conclusion... tid should be vid. I applied the patch in #8 for good measure. It all works. Can we get this into Dev?

amitaibu’s picture

Priority: Critical » Major
Status: Reviewed & tested by the community » Needs review
FileSize
1.27 KB

Does this work for you?

amitaibu’s picture

Testbot, wake up!

evans.bernier’s picture

amitaibu’s picture

Any testers?

pgillis’s picture

Status: Needs review » Reviewed & tested by the community

Tested locally and works for me.

amitaibu’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

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

christefano’s picture

This was committed but there hasn't been a 6.x-1.3 release yet.

christefano’s picture

Issue summary: View changes

There is now a 6.x-1.3 release for OG Vocab:

   https://www.drupal.org/node/2311423