Browse code

added moving privileges from subsciber to admin_privileges when reinstal

Karel Kozlik authored on 30/04/2004 11:03:54
Showing 1 changed files
... ...
@@ -720,15 +720,32 @@ case $1 in
720 720
 
721 721
 		# Recreate perms column here so that subsequent
722 722
 		# restore succeeds
723
-		
723
+
724
+    sql_query $DBNAME << EOF
725
+    ALTER TABLE subscriber ADD perms VARCHAR(32)  AFTER ha1b;
726
+    ALTER TABLE pending ADD perms VARCHAR(32)  AFTER ha1b;
727
+EOF
728
+
729
+
724 730
 		ser_restore $DBNAME ${tmp_file}.2
725 731
 		if [ "$?" -ne 0 ] ; then
726 732
 			echo "reinstall: restoring table failed"
727 733
 			rm $tmp_file*
728 734
 			exit 1
729 735
 		fi
730
-		
736
+
737
+
738
+    sql_query $DBNAME << EOF
739
+
740
+    # Move perms from subscriber to admin_privileges
741
+    INSERT INTO admin_privileges ($USERCOL, domain, priv_name, priv_value) SELECT $USERCOL, domain, 'is_admin', '1' FROM subscriber WHERE perms='admin';
742
+
731 743
 		# Drop perms column here
744
+    ALTER TABLE subscriber DROP perms;
745
+    ALTER TABLE pending DROP perms;
746
+
747
+EOF
748
+
732 749
 #XX
733 750
 #		rm $tmp_file*
734 751
 		exit 0