[open-ils-commits] r13708 - trunk/Open-ILS/src/perlmods/OpenILS/Application (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jul 23 10:52:00 EDT 2009


Author: erickson
Date: 2009-07-23 10:51:57 -0400 (Thu, 23 Jul 2009)
New Revision: 13708

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
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

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm	2009-07-23 13:42:10 UTC (rev 13707)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm	2009-07-23 14:51:57 UTC (rev 13708)
@@ -3334,5 +3334,32 @@
     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;
 



More information about the open-ils-commits mailing list