[evolvis-commits] r17208: Merged from evolvis-packaging: SQL hack to fix upgrade to new RBAC

mirabilos at evolvis.org mirabilos at evolvis.org
Fri May 6 17:02:46 CEST 2011


Author: mirabilos
Date: 2011-05-06 17:02:46 +0200 (Fri, 06 May 2011)
New Revision: 17208

Added:
   trunk/gforge_base/evolvisforge-5.1/src/db/20100518-evolvis-pre-pfo-rbac.sql
Modified:
   trunk/gforge_base/evolvisforge-5.1/src/deb-specific/db-upgrade.pl
Log:
Merged from evolvis-packaging: SQL hack to fix upgrade to new RBAC

Added: trunk/gforge_base/evolvisforge-5.1/src/db/20100518-evolvis-pre-pfo-rbac.sql
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/db/20100518-evolvis-pre-pfo-rbac.sql	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/src/db/20100518-evolvis-pre-pfo-rbac.sql	2011-05-06 15:02:46 UTC (rev 17208)
@@ -0,0 +1,23 @@
+CREATE FUNCTION upgrade_default_role_to_admin () RETURNS void AS $$
+DECLARE
+	g groups%ROWTYPE ;
+BEGIN
+	FOR g IN SELECT * FROM groups
+	LOOP
+		UPDATE user_group SET role_id=(
+		       SELECT min(r.role_id)
+		       FROM role r JOIN role_setting rs USING (role_id)
+		       WHERE r.group_id=g.group_id 
+		       	     AND rs.section_name='projectadmin'
+			     AND rs.value='A'
+		       )
+		WHERE role_id=1
+		      AND group_id=g.group_id;
+	END LOOP ;
+
+END ;
+$$ LANGUAGE plpgsql ;
+
+SELECT upgrade_default_role_to_admin () ;
+
+DROP FUNCTION upgrade_default_role_to_admin () ;

Modified: trunk/gforge_base/evolvisforge-5.1/src/deb-specific/db-upgrade.pl
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/deb-specific/db-upgrade.pl	2011-05-04 14:51:41 UTC (rev 17207)
+++ trunk/gforge_base/evolvisforge-5.1/src/deb-specific/db-upgrade.pl	2011-05-06 15:02:46 UTC (rev 17208)
@@ -2204,6 +2204,7 @@
     &update_with_sql("20100505-alter-user-preference","5.0.1-1");
     &update_with_sql("20100506-add-widgets","5.0.1-2");
     &update_with_sql("20100517-add-project-widgets","5.0.1-3");
+    &update_with_sql("20100518-evolvis-pre-pfo-rbac","5.0.1-3+evolvis1");
     &update_with_sql("20100518-pfo-rbac","5.0.1-4");
     &update_with_sql("20100524-pfo-rbac","5.0.1-5");
     &update_with_sql("20100606-clean-perm-views","5.0.1-6");



More information about the evolvis-commits mailing list