Index: openacs-4/packages/dotlrn/tcl/community-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.tcl,v diff -u -r1.183.2.3.4.2 -r1.183.2.3.4.3 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 20 May 2004 08:30:26 -0000 1.183.2.3.4.2 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 17 Jun 2004 01:58:07 -0000 1.183.2.3.4.3 @@ -392,7 +392,7 @@ ad_proc -private get_default_roles_not_cached { {-community_type:required} } { - if {[string match $community_type dotlrn_club]} { + if {[string match $community_type dotlrn_club] || [string match $community_type dotlrn_pers_community]} { set community_type dotlrn_community } elseif {![string match $community_type dotlrn_community]} { set community_type dotlrn_class_instance @@ -887,6 +887,18 @@ util_memoize_flush_regexp $user_id } + ad_proc -public remove_user_from_all { + {-user_id:required} + } { + Remove a user from all communities + } { + foreach community_ns_set [dotlrn_community::get_all_communities_by_user $user_id] { + set community_id [ns_set get $community_ns_set community_id] + if { [member_p $community_id $user_id] } { + dotlrn_community::remove_user $community_id $user_id + } + } + } ad_proc -public get_all_communities_by_user { user_id @@ -1152,7 +1164,7 @@ {-community_id:required} } { Returns a tcl list of ns_sets with info about each subcomm. The keys - are: community_id, community_key, pretty_name, and url + are: community_id, community_key, pretty_name, archived_p and url. Returns both archived and unarchived subcommunities. } { return [db_list_of_ns_sets select_subcomms_info {}] } @@ -1779,27 +1791,27 @@ 1. the community is marked as archived 2. the RemovePortlet callback is called for all users of the - community (both members and GAs) and all the applets. This - removes the comm's data from their workspaces + community (both members and GAs) and all the applets. - 3. all users of the community have their "read" privs revoked on the - comm's portal so that only SWA's can view the archived community + 3. Do this recursively for all subcommunities. } { db_transaction { # do RemoveUserFromCommunity callback, which # calls the RemovePortlet proc with the right params + + foreach subcomm_id [get_subcomm_list -community_id $community_id] { + archive -community_id $subcomm_id + } + foreach user [list_users $community_id] { set user_id [ns_set get $user user_id] applets_dispatch \ - -community_id $community_id \ - -op RemoveUserFromCommunity \ - -list_args [list $community_id $user_id] + -community_id $community_id \ + -op RemoveUserFromCommunity \ + -list_args [list $community_id $user_id] } - # revoke privs - rel_segments_revoke_permission -community_id $community_id - # mark the community as archived db_dml update_archive_p {} }