added moving privileges from subsciber to admin_privileges when reinstal
authorKarel Kozlik <karel@iptel.org>
Fri, 30 Apr 2004 11:03:54 +0000 (11:03 +0000)
committerKarel Kozlik <karel@iptel.org>
Fri, 30 Apr 2004 11:03:54 +0000 (11:03 +0000)
scripts/ser_mysql.sh

index 983a4eb..e597296 100755 (executable)
@@ -720,15 +720,32 @@ case $1 in
 
                # Recreate perms column here so that subsequent
                # restore succeeds
-               
+
+    sql_query $DBNAME << EOF
+    ALTER TABLE subscriber ADD perms VARCHAR(32)  AFTER ha1b;
+    ALTER TABLE pending ADD perms VARCHAR(32)  AFTER ha1b;
+EOF
+
+
                ser_restore $DBNAME ${tmp_file}.2
                if [ "$?" -ne 0 ] ; then
                        echo "reinstall: restoring table failed"
                        rm $tmp_file*
                        exit 1
                fi
-               
+
+
+    sql_query $DBNAME << EOF
+
+    # Move perms from subscriber to admin_privileges
+    INSERT INTO admin_privileges ($USERCOL, domain, priv_name, priv_value) SELECT $USERCOL, domain, 'is_admin', '1' FROM subscriber WHERE perms='admin';
+
                # Drop perms column here
+    ALTER TABLE subscriber DROP perms;
+    ALTER TABLE pending DROP perms;
+
+EOF
+
 #XX
 #              rm $tmp_file*
                exit 0