Index: openacs-4/packages/dotlrn/tcl/dotlrn-security-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/dotlrn-security-procs.tcl,v
diff -u -r1.54.2.1.4.7 -r1.54.2.1.4.8
--- openacs-4/packages/dotlrn/tcl/dotlrn-security-procs.tcl 23 Dec 2004 03:22:03 -0000 1.54.2.1.4.7
+++ openacs-4/packages/dotlrn/tcl/dotlrn-security-procs.tcl 2 Mar 2005 19:55:20 -0000 1.54.2.1.4.8
@@ -191,28 +191,41 @@
ad_proc -public remove_user_completely {
{-user_id:required}
+ {-on_fail soft_delete}
} {
- Remove the user from ACS as well
+ Remove the user from ACS as well. Chances are pretty good that
+ this will fail because it's hard to chase down every piece
+ of content the user has ever put into the system. The net result is
+ that there may be stray referential integrity contraints that
+ will throw errors when we try to remove the user record permanently.
+
+ @param on_fail indicates what we do if the permanent removal fails. Setting to
+ soft_delete
will result in a repeat call to acs_user::delete
+ but this time without the -permanent
flag. Setting to error
+ (or anything else) will result in re-throwing the original error.
} {
- # DEDS: for now let us not remove users with historical data.
- # we assume this by looking at last_visit which is lame but
- # the safest for now. the consortium might want to decide on
- # whether we also want nuking of users with data present
- set last_visit [acs_user::get_element -user_id $user_id -element last_visit]
- if {[empty_string_p $last_visit]} {
- if {[user_p -user_id $user_id]} {
- user_remove -user_id $user_id
- }
-
- # cycle through the applets and invoke their RemoveUser procs
- foreach applet_key [dotlrn_applet::list_mounted_applets] {
- dotlrn_community::applet_call \
- $applet_key \
- RemoveUser \
- [list $user_id]
- }
-
+ if {[user_p -user_id $user_id]} {
+ user_remove -user_id $user_id
+ }
+
+ # cycle through the applets and invoke their RemoveUser procs
+ foreach applet_key [dotlrn_applet::list_mounted_applets] {
+ ns_log Debug "dotlrn::remove_user_completely: invoking RemoveUser for applet $applet_key"
+ dotlrn_community::applet_call \
+ $applet_key \
+ RemoveUser \
+ [list $user_id]
+ }
+
+ if { [catch {
acs_user::delete -user_id $user_id -permanent
+ } errMsg] } {
+ ns_log Notice "dotlrn::remove_user_completely: permanent removal failed for user $user_id. Invoking on_fail option '$on_fail'"
+ if { [string equal $on_fail soft_delete] } {
+ acs_user::delete -user_id $user_id
+ } else {
+ error $errMsg
+ }
}
}
Index: openacs-4/packages/dotlrn/www/admin/user-nuke.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/user-nuke.adp,v
diff -u -r1.2 -r1.2.6.1
--- openacs-4/packages/dotlrn/www/admin/user-nuke.adp 4 Dec 2002 09:51:04 -0000 1.2
+++ openacs-4/packages/dotlrn/www/admin/user-nuke.adp 2 Mar 2005 19:55:23 -0000 1.2.6.1
@@ -8,4 +8,13 @@
#dotlrn.lt_Please_confirm_that_y#
+
+
+#dotlrn.Last_Visit#
+#dotlrn.Number_of_db_objects#: @n_objects@
+
+