[Fusionforge-commits] r14628 - in trunk: . src/plugins/moinmoin/etc src/plugins/moinmoin/lib

Roland Mas lolando at fusionforge.org
Fri Oct 14 18:02:52 CEST 2011


Author: lolando
Date: 2011-10-14 18:02:52 +0200 (Fri, 14 Oct 2011)
New Revision: 14628

Modified:
   trunk/
   trunk/src/plugins/moinmoin/etc/wikiconfig.py
   trunk/src/plugins/moinmoin/lib/fusionforge_session.py
Log:
Map FF users with forge_admin to MoinMoin superusers

Modified: trunk/src/plugins/moinmoin/etc/wikiconfig.py
===================================================================
--- trunk/src/plugins/moinmoin/etc/wikiconfig.py	2011-10-14 16:02:43 UTC (rev 14627)
+++ trunk/src/plugins/moinmoin/etc/wikiconfig.py	2011-10-14 16:02:52 UTC (rev 14628)
@@ -18,4 +18,7 @@
     data_dir = '/var/lib/gforge/plugins/moinmoin/wikidata/data'
     data_underlay_dir = '/var/lib/gforge/plugins/moinmoin/wikidata/underlay'
 
-    auth = [FusionForgeSessionAuth()]
+    ffsa = FusionForgeSessionAuth()
+
+    auth = [ffsa]
+    superuser = ffsa.get_super_users()

Modified: trunk/src/plugins/moinmoin/lib/fusionforge_session.py
===================================================================
--- trunk/src/plugins/moinmoin/lib/fusionforge_session.py	2011-10-14 16:02:43 UTC (rev 14627)
+++ trunk/src/plugins/moinmoin/lib/fusionforge_session.py	2011-10-14 16:02:52 UTC (rev 14628)
@@ -50,6 +50,14 @@
                                          port=self.database_port,
                                          password=self.database_password)
 
+    def get_super_users(self):
+        cur = self.conn.cursor()
+        cur.execute("SELECT distinct(u.user_name) from users u, pfo_user_role pur, pfo_role pr, pfo_role_setting prs WHERE u.user_id = pur.user_id AND pur.role_id = pr.role_id AND pr.role_id = prs.role_id AND prs.section_name='forge_admin'")
+        admins = []
+        for record in cur:
+            admins.append(record[0])
+        return admins
+
     def request(self, request, user_obj, **kw):
         cookies = kw.get('cookie')
         if cookies is None or cookies == {}:




More information about the Fusionforge-commits mailing list