[open-ils-commits] r17983 - branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Sep 24 20:56:51 EDT 2010


Author: senator
Date: 2010-09-24 20:56:50 -0400 (Fri, 24 Sep 2010)
New Revision: 17983

Modified:
   branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
Backport r17982 from trunk


Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm	2010-09-25 00:56:24 UTC (rev 17982)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm	2010-09-25 00:56:50 UTC (rev 17983)
@@ -1275,10 +1275,11 @@
     my $api = $self->api_name;
 
     if( $api =~ /password/o ) {
-
         # make sure the original password matches the in-database password
-        return OpenILS::Event->new('INCORRECT_PASSWORD')
-            if md5_hex($orig_pw) ne $db_user->passwd;
+        if (md5_hex($orig_pw) ne $db_user->passwd) {
+            $e->rollback;
+            return new OpenILS::Event('INCORRECT_PASSWORD');
+        }
         $db_user->passwd($new_val);
 
     } else {
@@ -1291,7 +1292,10 @@
 
             # make sure no one else has this username
             my $exist = $e->search_actor_user({usrname=>$new_val},{idlist=>1}); 
-			return OpenILS::Event->new('USERNAME_EXISTS') if @$exist;
+            if (@$exist) {
+                $e->rollback;
+                return new OpenILS::Event('USERNAME_EXISTS');
+            }
             $db_user->usrname($new_val);
 
         } elsif( $api =~ /email/o ) {
@@ -2477,13 +2481,13 @@
 sub update_user_note {
 	my( $self, $conn, $auth, $note ) = @_;
 	my $e = new_editor(authtoken=>$auth, xact=>1);
-	return $e->event unless $e->checkauth;
+	return $e->die_event unless $e->checkauth;
 	my $patron = $e->retrieve_actor_user($note->usr)
-		or return $e->event;
-	return $e->event unless 
+		or return $e->die_event;
+	return $e->die_event unless 
 		$e->allowed('UPDATE_USER', $patron->home_ou);
 	$e->update_actor_user_note($note)
-		or return $e->event;
+		or return $e->die_event;
 	$e->commit;
 	return 1;
 }
@@ -2883,7 +2887,7 @@
          	"flesh_fields" =>  { "au" => $fields }
       	}
    	]
-	) or return $e->event;
+	) or return $e->die_event;
 
 
 	if( grep { $_ eq 'addresses' } @$fields ) {
@@ -3258,7 +3262,7 @@
 sub apply_friend_perms {
     my($self, $conn, $auth, $user_id, $delegate_id, @perms) = @_;
     my $e = new_editor(authtoken => $auth, xact => 1);
-    return $e->event unless $e->checkauth;
+    return $e->die_event unless $e->checkauth;
 
     if($user_id != $e->requestor->id) {
         my $user = $e->retrieve_actor_user($user_id) or return $e->die_event;
@@ -3285,7 +3289,7 @@
 sub update_user_pending_address {
     my($self, $conn, $auth, $addr) = @_;
     my $e = new_editor(authtoken => $auth, xact => 1);
-    return $e->event unless $e->checkauth;
+    return $e->die_event unless $e->checkauth;
 
     if($addr->usr != $e->requestor->id) {
         my $user = $e->retrieve_actor_user($addr->usr) or return $e->die_event;



More information about the open-ils-commits mailing list