From 4a3a7193dbe5388b5672f29108c59dedeee65cc4 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 6 Aug 2013 10:10:19 -0400 Subject: [PATCH] LP1207396 user stage allows username selection The caller may now pass a value for username. If unset, it still falls back to using a uuid. If the username clashes with an existing staged username, a USERNAME_EXISTS event is returned. Signed-off-by: Bill Erickson Signed-off-by: Dan Wells --- .../src/perlmods/lib/OpenILS/Application/Actor/Stage.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Stage.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Stage.pm index ff608791c8..8f094b7204 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Stage.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Stage.pm @@ -38,9 +38,13 @@ sub create_user_stage { my $e = new_editor(xact => 1); - my $uname = $U->create_uuid_string; + my $uname = $user->usrname || $U->create_uuid_string; $user->usrname($uname); + # see if this username is already taken + return OpenILS::Event->new('USERNAME_EXISTS') if + $e->search_staging_user_stage({usrname => $uname})->[0]; + $e->create_staging_user_stage($user) or return $e->die_event; if($mail_addr) { -- 2.43.2