[siesta-commit] siesta/bin nacho,1.13,1.14

[prev] [thread] [next] [lurker] [Date index for 2002/09/11]

From: muttley
Subject: [siesta-commit] siesta/bin nacho,1.13,1.14
Date: 16:03 on 11 Sep 2002
Update of /cvsroot/siesta/siesta/bin
In directory usw-pr-cvs1:/tmp/cvs-serv18135/bin

Modified Files:
	nacho 
Log Message:
Added in code to create a new user if one doesn't exist when adding a 
new user to a list.


Index: nacho
===================================================================
RCS file: /cvsroot/siesta/siesta/bin/nacho,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- nacho	11 Sep 2002 11:13:52 -0000	1.13
+++ nacho	11 Sep 2002 15:03:46 -0000	1.14
@@ -362,8 +362,14 @@
     while ($user_id) {
 
         # TODO - create new user if not valid
-        my $user = Siesta::User->new($user_id)
-          || die "$user_id is not a valid user id\n";
+        my $user = Siesta::User->new($user_id);
+
+	unless (defined $user) {
+		$user = Siesta::User->new_from_hash(id=>$user_id) || die "Couldn't create a new user\n";
+		$user->save();
+		print "Created a new user '$user_id' - don't forget to set more details for them\n";
+ 
+	}
 
         $list->add_member($user);
 



Generated at 13:57 on 01 Jul 2004 by mariachi 0.52