From: erickson Date: Thu, 23 Jul 2009 14:51:57 +0000 (+0000) Subject: added api call for calling the new actor.usr_delete stored procedure, which purges... X-Git-Tag: sprint4-merge-nov22~9624 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f092f80b37635bfa711689def6273e92e8e83e9d;p=working%2FEvergreen.git added api call for calling the new actor.usr_delete stored procedure, which purges user data/xacts, anonymizes top-level user data, and transfers data to another user where necessary git-svn-id: svn://svn.open-ils.org/ILS/trunk@13708 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm index 7d1c5b19fb..f7bdcd070b 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm @@ -3334,5 +3334,32 @@ sub update_events { return {complete => 1}; } + +__PACKAGE__->register_method ( + method => 'really_delete_user', + api_name => 'open-ils.actor.user.delete', + signature => q/ + It anonymizes all personally identifiable information in actor.usr. By calling actor.usr_purge_data() + it also purges related data from other tables, sometimes by transferring it to a designated destination user. + The usrname field (along with first_given_name and family_name) is updated to id '-PURGED-' now(). + dest_usr_id is only required when deleting a user that performs staff functions. + / +); + +sub really_delete_user { + my($self, $conn, $auth, $user_id, $dest_user_id) = @_; + my $e = new_editor(authtoken => $auth, xact => 1); + return $e->die_event unless $e->checkauth; + my $user = $e->retrieve_actor_user($user_id) or return $e->die_event; + return $e->die_event unless $e->allowed('DELETE_USER', $user->home_ou); + my $stat = $e->json_query( + {from => ['actor.usr_delete', $user_id, $dest_user_id]})->[0] + or return $e->die_event; + $e->commit; + return 1; +} + + + 1;