Index: l10n_community/l10n_community.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/l10n_community.module,v
retrieving revision 1.1.2.23.2.61
diff -u -p -r1.1.2.23.2.61 l10n_community.module
--- l10n_community/l10n_community.module	5 Dec 2009 13:44:56 -0000	1.1.2.23.2.61
+++ l10n_community/l10n_community.module	5 Dec 2009 14:16:29 -0000
@@ -974,20 +974,14 @@ function l10n_community_get_permission($
   }
   if (!isset($permissions[$account->uid][$langcode])) {
     // Minimal permission.
-    $global = L10N_PERM_NONE;
-    $global |= user_access('browse translations', $account) ? L10N_PERM_VIEW : 0;
-    $global |= user_access('submit suggestions', $account) ? L10N_PERM_SUGGEST : 0;
-    $global |= user_access('moderate suggestions from others', $account) ? L10N_PERM_MODERATE_OTHERS : 0;
-    $global |= user_access('moderate own suggestions', $account) ? L10N_PERM_MODERATE_OWN : 0;
-    $global |= user_access('import gettext files', $account) ? L10N_PERM_IMPORT : 0;
-    $global |= user_access('export gettext templates and translations', $account) ? L10N_PERM_EXPORT : 0;
-
-    if (!module_exists('l10n_groups')) {
-      $permissions[$account->uid][$langcode] = $global;
-    }
-    else {
-      l10n_groups_get_permission($permissions, $account, $global);
-    }
+    $perm = L10N_PERM_NONE;
+    $perm |= user_access('browse translations', $account) ? L10N_PERM_VIEW : 0;
+    $perm |= user_access('submit suggestions', $account) ? L10N_PERM_SUGGEST : 0;
+    $perm |= user_access('moderate suggestions from others', $account) ? L10N_PERM_MODERATE_OTHERS : 0;
+    $perm |= user_access('moderate own suggestions', $account) ? L10N_PERM_MODERATE_OWN : 0;
+    $perm |= user_access('import gettext files', $account) ? L10N_PERM_IMPORT : 0;
+    $perm |= user_access('export gettext templates and translations', $account) ? L10N_PERM_EXPORT : 0;
+    $permissions[$account->uid][$langcode] = $perm;
   }
 
   // Return from local cache.
Index: l10n_groups/l10n_groups.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_groups/Attic/l10n_groups.info,v
retrieving revision 1.1.2.1.2.1
diff -u -p -r1.1.2.1.2.1 l10n_groups.info
--- l10n_groups/l10n_groups.info	14 Oct 2008 22:13:49 -0000	1.1.2.1.2.1
+++ l10n_groups/l10n_groups.info	5 Dec 2009 14:16:29 -0000
@@ -1,7 +1,7 @@
 ; $Id: l10n_groups.info,v 1.1.2.1.2.1 2008/10/14 22:13:49 goba Exp $
 name = "Localization groups"
 description = Organic groups mapping for localization server
-dependencies[] = og
+dependencies[] = og_user_roles
 dependencies[] = l10n_community
 package = "Localization server"
 core = 6.x
Index: l10n_groups/l10n_groups.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_groups/Attic/l10n_groups.install,v
retrieving revision 1.1.2.1.2.3
diff -u -p -r1.1.2.1.2.3 l10n_groups.install
--- l10n_groups/l10n_groups.install	12 Sep 2009 08:28:13 -0000	1.1.2.1.2.3
+++ l10n_groups/l10n_groups.install	5 Dec 2009 14:16:29 -0000
@@ -58,3 +58,62 @@ function l10n_groups_schema() {
   );
   return $schema;
 }
+
+// -- Drupal 6 updates ---------------------------------------------------------
+
+/**
+ * Migrate user permissions to og_user_roles.
+ */
+function l10n_groups_update_6000() {
+  $ret = array();
+
+  /*
+    Permissions table.
+
+    'access localization community',             -- expected to be given to authenticated users
+    'browse translations',                       -- see prev.
+    'administer localization community',         -- see prev.
+    'export gettext templates and translations', -- given to "translation team mamber"
+    'import gettext files',                      -- given to "translation team member"
+    'submit suggestions',                        -- given to "translation team member"
+    'moderate suggestions from others',          -- given to "translation community moderator"
+    'moderate own suggestions',                  -- given to "translation self-moderator"
+  */
+
+  // Remove permissions which are to be granted via og_user_roles from now on.
+  $result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
+  while ($role = db_fetch_object($result)) {
+    $existing_perms = explode(', ', $role->perm);
+    $new_perms = array_diff($existing_perms, array('export gettext templates and translations', 'import gettext files', 'submit suggestions', 'moderate suggestions from others', 'moderate own suggestions'));
+    db_query("UPDATE {permission} SET perm = '%s' WHERE rid = %d", implode(', ', $new_perms), $rid);
+  }
+
+  // Create three new roles to be used with og_user_roles.
+  db_query("INSERT INTO {role} (name) VALUES ('%s')", 'translation team member');
+  $role_team = db_result(db_query_range("SELECT rid FROM {role} WHERE name ='translation team member'", 0, 1));
+  db_query("INSERT INTO {role} (name) VALUES ('%s')", 'translation self-moderator');
+  $role_self = db_result(db_query_range("SELECT rid FROM {role} WHERE name ='translation self-moderator'", 0, 1));
+  db_query("INSERT INTO {role} (name) VALUES ('%s')", 'translation community moderator');
+  $role_community = db_result(db_query_range("SELECT rid FROM {role} WHERE name ='translation community moderator'", 0, 1));
+
+  // Grant basic team permissions.
+  $perms = array('export gettext templates and translations', 'import gettext files', 'submit suggestions');
+  db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $role_team, implode(', ', $perms));
+
+  // Grant self-moderation permission.
+  $perms = array('moderate own suggestions');
+  db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $role_self, implode(', ', $perms));
+
+  // Grant community moderation permission.
+  $perms = array('moderate suggestions from others');
+  db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $role_community, implode(', ', $perms));
+
+  // Grant base team permissions to team members, moderation permissions to admins.
+  db_query('INSERT INTO {og_users_roles} (gid, uid, rid) SELECT nid, uid, %d FROM {og_uid}', $role_team);
+  db_query('INSERT INTO {og_users_roles} (gid, uid, rid) SELECT nid, uid, %d FROM {og_uid} WHERE is_admin = 1', $role_self);
+  db_query('INSERT INTO {og_users_roles} (gid, uid, rid) SELECT nid, uid, %d FROM {og_uid} WHERE is_admin = 1', $role_community);
+
+  // @todo: add code to set up og_user_roles for correct future use.
+
+  return $ret;
+}
Index: l10n_groups/l10n_groups.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_groups/Attic/l10n_groups.module,v
retrieving revision 1.1.2.4.2.8
diff -u -p -r1.1.2.4.2.8 l10n_groups.module
--- l10n_groups/l10n_groups.module	5 Dec 2009 13:44:56 -0000	1.1.2.4.2.8
+++ l10n_groups/l10n_groups.module	5 Dec 2009 14:16:29 -0000
@@ -272,38 +272,3 @@ function l10n_groups_get_groups() {
 
   return $groups;
 }
-
-/**
- * Get permission level for a specific user based on group membership.
- *
- * The group permission model is taken into account and membership of
- * the user in language groups is checked.
- *
- * @param $permissions
- *   Permission cache array to tunnel cache values to.
- * @param $account
- *   Optional user account.
- * @param $global
- *   Permission based on user access settings to consider as a base.
- */
-function l10n_groups_get_permission(&$permissions, $account, $global) {
-  if ($groups = l10n_groups_get_groups()) {
-    // Fill up local cache with all langcode permissions of this account for
-    // future reference (eg. a page showing links for all languages).
-    foreach ($groups as $group) {
-      $perm = $global;
-
-      if (empty($account->og_groups) || empty($account->og_groups[$group->nid])) {
-        // The user is not in the group and may therefore only view.
-        $perm = $perm & ~(L10N_PERM_CONTRIBUTE | L10N_PERM_REVIEW);
-      }
-      elseif (empty($account->og_groups[$group->nid]['is_admin']) && $group->model != L10N_MODEL_OPEN) {
-        // Non-admins of group don't have review permissions but can contribute.
-        // Open groups consider all members as admins regarding reviews.
-        $perm = $perm & ~(L10N_PERM_REVIEW);
-      }
-
-      $permissions[$account->uid][$group->language] = $perm;
-    }
-  }
-}
