? og_vocab_perm.patch
Index: og_vocab.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/og_vocab/og_vocab.module,v
retrieving revision 1.11.2.2
diff -u -r1.11.2.2 og_vocab.module
--- og_vocab.module	1 Jan 2007 20:31:14 -0000	1.11.2.2
+++ og_vocab.module	14 Mar 2007 16:58:27 -0000
@@ -16,12 +16,17 @@
   }
 }
 
+function og_vocab_perm() {
+  return array('administer organic groups vocabulary');
+}
+
 /**
  * Implementation of hook_menu().
  */
 function og_vocab_menu($may_cache) {
   $items = array();
   global $user;
+  $access = user_access('administer organic groups vocabulary');
 
   if ($may_cache) {
     //
@@ -40,6 +45,7 @@
 
         $items[] = array('path' => "node/$gid/og/vocab/add/vocabulary",
           'title' => t('Create vocabulary'),
+          'access' => $access,
           'callback' => 'drupal_get_form',
           'callback arguments' => array('taxonomy_form_vocabulary'),
           'type' => MENU_CALLBACK);  
@@ -65,6 +71,7 @@
     
           $items[] = array('path' => "node/$gid/og/vocab/edit/vocabulary/$vid",
             'title' => t('Edit vocabulary'),
+            'access' => $access,
             'callback' => 'taxonomy_admin_vocabulary_edit',
             'callback arguments' => array($vid),
             'type' => MENU_CALLBACK);  
@@ -222,11 +229,17 @@
  * List and manage vocabularies for a given group.
  */
 function og_vocab_overview_vocabularies($gid) {
+  global $user;
+  $access = user_access('administer organic groups vocabulary');
   $groupnode = node_load((int)$gid);
   drupal_set_title($groupnode->title);
   // i tried fixing breadcrumb here with drupal_set_breadcrumb() and menu_set_location() but neither is satisfactory
   
-  $links[] = l(t('add vocabulary'), "node/$gid/og/vocab/add/vocabulary", array(), drupal_get_destination());
+  // if user role has access to administer vocabulary, print 'add vocabulary' link
+  if ($access) {
+    $links[] = l(t('add vocabulary'), "node/$gid/og/vocab/add/vocabulary", array(), drupal_get_destination());
+  }
+  
   $output = theme('item_list', $links);
   $vocabularies = og_vocab_load_vocabularies($gid);
   foreach ($vocabularies as $vid => $vocabulary) {
@@ -235,13 +248,17 @@
       $node_type = node_get_types('name', $type);
       $types[] = $node_type ? $node_type : $type;
     }
-    $rows[] = array(
+    $row = array(
         check_plain($vocabulary->name),
         implode(', ', $types),
-        l(t('edit vocabulary'), "node/$gid/og/vocab/edit/vocabulary/$vocabulary->vid", array(), drupal_get_destination()),
         l(t('list terms'), "node/$gid/og/vocab/terms/$vocabulary->vid"),
         l(t('add terms'), "node/$gid/og/vocab/terms/$vocabulary->vid/add/term"),
     );
+    // if user role has access to administer vocabulary, print 'edit vocabulary' link
+    if ($access) {
+      $row[] = l(t('edit vocabulary'), "node/$gid/og/vocab/edit/vocabulary/$vocabulary->vid", array(), drupal_get_destination());
+    }
+    $rows[] = $row;
   }
   if (!$rows) {
     $rows[] = array(array('data' => t('No categories'), 'colspan' => 5));
