[open-ils-commits] r11118 - trunk/Open-ILS/src/perlmods/OpenILS/Application
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Nov 10 13:21:28 EST 2008
Author: erickson
Date: 2008-11-10 13:21:25 -0500 (Mon, 10 Nov 2008)
New Revision: 11118
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
added user password verify method. pass in the md5sum of the pw, return true if it's a match with the in-DB password
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2008-11-10 17:49:15 UTC (rev 11117)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2008-11-10 18:21:25 UTC (rev 11118)
@@ -2961,5 +2961,32 @@
}
+__PACKAGE__->register_method (
+ method => 'verify_user_password',
+ api_name => 'open-ils.actor.verify_user_password',
+ signature => q/
+ Given a barcode or username and the MD5 encoded password,
+ returns 1 if the password is correct. Returns 0 otherwise.
+ /
+);
+
+sub verify_user_password {
+ my($self, $conn, $auth, $barcode, $username, $password) = @_;
+ my $e = new_editor(authtoken => $auth);
+ return $e->die_event unless $e->checkauth;
+ my $user;
+ if($barcode) {
+ my $card = $e->search_actor_card([
+ {barcode => $barcode},
+ {flesh => 1, flesh_fields => {ac => ['usr']}}])->[0] or return 0;
+ $user = $card->usr;
+ } else {
+ $user = $e->search_actor_user({usrname => $username})->[0] or return 0;
+ }
+ return $e->event unless $e->allowed('VIEW_USER', $user->home_ou);
+ return 1 if $user->passwd eq $password;
+ return 0;
+}
+
1;
More information about the open-ils-commits
mailing list