Index: openacs-4/packages/acs-authentication/tcl/sync-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/sync-procs.tcl,v
diff -u -r1.29 -r1.30
--- openacs-4/packages/acs-authentication/tcl/sync-procs.tcl 29 Oct 2003 13:28:44 -0000 1.29
+++ openacs-4/packages/acs-authentication/tcl/sync-procs.tcl 31 Oct 2003 09:29:15 -0000 1.30
@@ -355,8 +355,12 @@
}
insert {
if { ![empty_string_p $user_id] } {
- set success_p 0
- set result(message) "A user with username '$username' already exists"
+ acs_user::get -user_id $user_id -array existing_user_info
+ if { ![string equal $existing_user_info(member_state) "banned"] } {
+ # Inserting a user that already exists (and is not deleted)
+ set success_p 0
+ set result(message) "A user with username '$username' already exists"
+ }
}
}
}
Index: openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl,v
diff -u -r1.13 -r1.14
--- openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl 23 Oct 2003 10:27:36 -0000 1.13
+++ openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl 31 Oct 2003 09:29:17 -0000 1.14
@@ -166,11 +166,7 @@
aa_equals "entry.success_p" $entry(success_p) "f"
- if { [aa_true "entry.element_messages not empty" [exists_and_not_null entry(element_messages)]] } {
- array unset elm_msgs
- array set elm_msgs $entry(element_messages)
- aa_true "username, email have problems" [util_sets_equal_p { username email } [array names elm_msgs]]
- }
+ aa_true "entry.message not empty" [exists_and_not_null entry(message)]
aa_log "entry.user_id = '$entry(user_id)'"
aa_log "entry.message = '$entry(message)'"
@@ -669,7 +665,7 @@
aa_true "email has a problem (email missing)" [util_sets_equal_p { email } [array names elm_msgs]]
}
update {
- aa_true "username has a problem (don't have this user)" [util_sets_equal_p { username } [array names elm_msgs]]
+ aa_true "User does not exist" [expr ![empty_string_p $entry(message)]]
}
delete {
aa_false "Message is not empty" [empty_string_p $entry(message)]
@@ -703,10 +699,13 @@
$ims_doc(username)
-
- $ims_doc(first_names)
- $ims_doc(last_name)
-
+
+ $ims_doc(first_names) $ims_doc(last_name)
+
+ $ims_doc(first_names)
+ $ims_doc(last_name)
+
+
$ims_doc(email)
$ims_doc(url)
@@ -743,9 +742,8 @@
help_contact_text {}
batch_sync_enabled_p f
}
- set new_auth(get_doc_impl_id) 1
+
set new_auth(process_doc_impl_id) [acs_sc::impl::get_id -owner "acs-authentication" -name "IMS_Enterprise_v_1p1"]
-
set new_auth(get_doc_impl_id) [acs_sc::impl::get_id -owner "acs-authentication" -name "HTTPGet"]
set authority_id [auth::authority::create \
@@ -760,6 +758,8 @@
#
#####
+ aa_log "--- Insert test ---"
+
# Setup dummy variables
set ims_doc(recstatus) 1
set ims_doc(username) [ad_generate_random_string]
@@ -803,6 +803,8 @@
#
#####
+ aa_log "--- Update test ---"
+
# Setup dummy variables
set ims_doc(recstatus) 2
# username is unchanged
@@ -842,6 +844,8 @@
#
#####
+ aa_log "--- Delete test ---"
+
# Setup dummy variables
set ims_doc(recstatus) 3
# username is unchanged
@@ -881,6 +885,8 @@
#
#####
+ aa_log "--- Reuse username/email of a deleted user test ---"
+
# Setup dummy variables
set ims_doc(recstatus) 1
# same username
@@ -922,10 +928,20 @@
#
#####
- set elements [auth::sync::GetElements -authority_id $authority_id]
+ aa_log "--- GetElements test ---"
+
+ set desired_elements [ad_generate_random_string]
+
+ auth::driver::set_parameter_value \
+ -authority_id $authority_id \
+ -impl_id [acs_sc::impl::get_id -owner "acs-authentication" -name "IMS_Enterprise_v_1p1"] \
+ -parameter Elements \
+ -value $desired_elements
- aa_true "Elements are usernaem, email, first_names, last_name, url" [util_sets_equal_p { username email first_names last_name url } $elements]
+ set elements [auth::sync::GetElements -authority_id $authority_id]
+ aa_equals "Elements are '$desired_elements'" $elements $desired_elements
+
}
}