incubator-bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r1449636 - /incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/util.py
Date Mon, 25 Feb 2013 09:59:55 GMT
Author: matevz
Date: Mon Feb 25 09:59:54 2013
New Revision: 1449636

URL: http://svn.apache.org/r1449636
Log:
#404 - Populate default schema on product addition (copy TRAC_ADMIN from globals to newly
created product)

Modified:
    incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/util.py

Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/util.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/util.py?rev=1449636&r1=1449635&r2=1449636&view=diff
==============================================================================
--- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/util.py
(original)
+++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/util.py
Mon Feb 25 09:59:54 2013
@@ -30,6 +30,7 @@ class ProductDelegate(object):
 
         env.log.debug("Adding product info (%s) to tables:" % product.prefix)
         with env.db_direct_transaction as db:
+            # create the default entries for this Product from defaults
             for table in db_default.get_data(db):
                 if not table[0] in MultiProductSystem.MIGRATE_TABLES:
                     continue
@@ -42,3 +43,12 @@ class ProductDelegate(object):
                     (table[0], ','.join(cols), ','.join(['%s' for c in cols])),
                     rows)
 
+            # in addition copy global admin permissions (they are
+            # not part of the default permission table)
+            rows = db("""SELECT username FROM permission WHERE action='TRAC_ADMIN'
+                         AND product=''""")
+            rows = [(r[0], 'TRAC_ADMIN', product.prefix) for r in rows]
+            cols = ('username', 'action', 'product')
+            db.executemany("INSERT INTO permission (%s) VALUES (%s)" %
+                (','.join(cols), ','.join(['%s' for c in cols])), rows)
+



Mime
View raw message