? .cvsignore
Index: translation_overview.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/translation_overview/translation_overview.install,v
retrieving revision 1.3
diff -u -p -r1.3 translation_overview.install
--- translation_overview.install	16 Apr 2009 19:47:28 -0000	1.3
+++ translation_overview.install	16 Apr 2009 22:20:16 -0000
@@ -16,8 +16,6 @@ function translation_overview_install() 
  */
 function translation_overview_uninstall() {
   drupal_uninstall_schema('translation_overview');
-
-  variable_del('translation_overview_management');
 }
 
 /**
@@ -120,3 +118,34 @@ function translation_overview_update_600
 
   return $ret;
 }
+
+/**
+ * Store the manager information in permissions rather than our own variable.
+ */
+function translation_overview_update_6002() {
+  $ret = array();
+
+  $changes = array();
+  foreach (variable_get('translation_overview_management', array()) as $lang_code => $rids) {
+    foreach (array_filter($rids) as $rid => $true) {
+      $changes[$rid][] = 'manage '. check_plain($lang_code) .' translation overview priorities';
+    }
+  }
+
+  foreach ($changes as $rid => $perms) {
+    // Retrieve the currently set permissions.
+    $existing_perms = array();
+    $result = db_query("SELECT p.perm FROM {permission} p WHERE p.rid = %d ", $rid);
+    if ($row = db_fetch_object($result)) {
+      $perms = array_unique(array_merge($perms, explode(', ', $row->perm)));
+      $ret[] = update_sql('DELETE FROM {permission} WHERE rid = '. (int) $rid);
+    }
+
+    // Update the permissions.
+    $ret[] = update_sql("INSERT INTO {permission} (rid, perm) VALUES (". (int) $rid .", '". db_escape_string(implode(', ', $perms)) ."')");
+  }
+
+  variable_del('translation_overview_management');
+
+  return $ret;
+}
\ No newline at end of file
Index: translation_overview.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/translation_overview/translation_overview.module,v
retrieving revision 1.11
diff -u -p -r1.11 translation_overview.module
--- translation_overview.module	16 Apr 2009 22:16:57 -0000	1.11
+++ translation_overview.module	16 Apr 2009 22:20:16 -0000
@@ -10,8 +10,6 @@ define('TRANSLATION_OVERVIEW_IGNORE', 0)
  */
 function translation_overview_help($path, $arg) {
   switch ($path) {
-    case 'admin/settings/translation_overview':
-      return '<p>'. t('These settings control which roles are allowed to assign the translation priorities for each language. Only roles with the "manage translation overview priorities" permission are show.') .'</p>';
     case 'admin/content/translation_overview_manage':
       $args = array();
       $states = array('original', 'current', 'outofdate', 'missing');
@@ -34,10 +32,6 @@ function translation_overview_theme() {
       'arguments' => array('form' => array()),
       'file' => 'translation_overview.pages.inc',
     ),
-    'translation_overview_admin_settings_form' => array(
-      'arguments' => array('form' => array()),
-      'file' => 'translation_overview.admin.inc',
-    )
   );
 }
 
@@ -46,10 +40,12 @@ function translation_overview_theme() {
  * Implementation of hook_perm().
  */
 function translation_overview_perm() {
-  return array(
-    'manage translation overview priorities',
-    'view translation overview assigments',
-  );
+  $perms = array('view translation overview assigments');
+  foreach (locale_language_list() as $lang_code => $language) {
+    $perms[] = 'manage '. check_plain($lang_code) .' translation overview priorities';
+  }
+
+  return $perms;
 }
 
 
@@ -67,7 +63,7 @@ function translation_overview_menu() {
     'description' => "View the translation status of the site's content.",
     'page callback' => 'translation_overview_manager_page',
     'file' => 'translation_overview.pages.inc',
-    'access arguments' => array('manage translation overview priorities'),
+    'access callback' => 'translation_overview_is_manager',
   );
   $items['admin/content/translation_overview_assignments'] = array(
     'title' => 'Translator assigments',
@@ -92,15 +88,6 @@ function translation_overview_menu() {
       );
     }
   }
-  $items['admin/settings/translation_overview'] = array(
-    'title' => 'Translation overview',
-    'description' => 'Settings for the translation overview.',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('translation_overview_admin_settings_form'),
-    'access arguments' => array('administer site configuration'),
-    'type' => MENU_NORMAL_ITEM,
-    'file' => 'translation_overview.admin.inc',
-  );
   return $items;
 }
 
@@ -225,20 +212,16 @@ function translation_overview_get_node_p
  * @return Boolean
  */
 function translation_overview_is_manager($lang_code = NULL, $account = NULL) {
-  $management = variable_get('translation_overview_management', array());
-
-  if (is_null($account)) {
-    $account = $GLOBALS['user'];
-  }
-
   if (empty($lang_code)) {
-    $allowed = array();
-    foreach ($management as $lang => $rids) {
-      $allowed += array_filter($rids);
+    foreach (locale_language_list() as $lang_code => $language) {
+      if (user_access('manage '. check_plain($lang_code) .' translation overview priorities', $account)) {
+        return TRUE;
+      }
     }
-    return (boolean) count(array_intersect_key((array) $account->roles, $allowed));
+    return FALSE;
   }
-  return (isset($management[$lang_code]) && count(array_intersect_key((array) $account->roles, array_filter((array) $management[$lang_code]))));
+
+  return user_access('manage '. check_plain($lang_code) .' translation overview priorities', $account);
 }
 
 /**
