[Rt-commit] r17751 - in rt/3.999/trunk: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Jan 15 10:42:53 EST 2009


Author: sunnavy
Date: Thu Jan 15 10:42:53 2009
New Revision: 17751

Modified:
   rt/3.999/trunk/   (props changed)
   rt/3.999/trunk/sbin/rt-migrate-db-from-3.8

Log:
 r18793 at sunnavys-mb:  sunnavy | 2009-01-15 23:42:37 +0800
 handle users table in db migration script


Modified: rt/3.999/trunk/sbin/rt-migrate-db-from-3.8
==============================================================================
--- rt/3.999/trunk/sbin/rt-migrate-db-from-3.8	(original)
+++ rt/3.999/trunk/sbin/rt-migrate-db-from-3.8	Thu Jan 15 10:42:53 2009
@@ -171,5 +171,23 @@
     }
 );
 
-# TODO: update auth_token and password columns in Users
 
+use RT::Model::UserCollection;
+my $user_collection =
+  RT::Model::UserCollection->new( current_user => RT->system_user );
+
+while ( my $user = $user_collection->next ) {
+    my $name = $user->name;
+    $user->__set( column => 'email_confirmed', value => 1 )
+      unless $name eq 'RT_System';
+
+# generate auth_token column
+    $user->regenerate_auth_token;
+
+#   this is for attribute, no idea why to add this to attribute
+#    $user->generate_auth_token;
+
+    # TODO what's the best way to (re)set password?
+    $user->__set( column => 'password', value => 'password' )
+      if $name eq 'root';
+}


More information about the Rt-commit mailing list