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.133 -r1.134
--- openacs-4/packages/dotlrn/tcl/community-procs.tcl 24 May 2002 21:16:27 -0000 1.133
+++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 28 May 2002 21:57:05 -0000 1.134
@@ -812,7 +812,7 @@
} {
returns all communities for a user
} {
- return [db_list_of_lists select_communities_by_user {}]
+ return [db_list_of_ns_sets select_communities_by_user {}]
}
ad_proc -public get_communities_by_user {
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.43 -r1.44
--- openacs-4/packages/dotlrn/tcl/dotlrn-security-procs.tcl 24 May 2002 01:58:45 -0000 1.43
+++ openacs-4/packages/dotlrn/tcl/dotlrn-security-procs.tcl 28 May 2002 21:57:05 -0000 1.44
@@ -231,7 +231,7 @@
}
ad_proc -public user_can_browse_p {
- {user_id ""}
+ {-user_id ""}
} {
Check is a user can browse dotLRN
} {
Index: openacs-4/packages/dotlrn/www/dotlrn-default-master.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/dotlrn-default-master.adp,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/dotlrn/www/dotlrn-default-master.adp 24 May 2002 01:58:45 -0000 1.4
+++ openacs-4/packages/dotlrn/www/dotlrn-default-master.adp 28 May 2002 21:57:05 -0000 1.5
@@ -57,7 +57,7 @@
Index: openacs-4/packages/dotlrn/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/index.tcl,v
diff -u -r1.34 -r1.35
--- openacs-4/packages/dotlrn/www/index.tcl 24 May 2002 01:58:45 -0000 1.34
+++ openacs-4/packages/dotlrn/www/index.tcl 28 May 2002 21:57:05 -0000 1.35
@@ -23,61 +23,55 @@
} -query {
{filter ""}
{page_num 0}
-} -properties {
}
-# Check if this is a community type level thing
if {[parameter::get -parameter community_type_level_p] == 1} {
ad_returnredirect "one-community-type"
ad_script_abort
-}
-
-# Check if this is a community level thing
-if {[parameter::get -parameter community_level_p] == 1} {
+} elseif {[parameter::get -parameter community_level_p] == 1} {
ad_returnredirect "one-community?page_num=$page_num"
ad_script_abort
}
-# Make sure user is logged in
set user_id [ad_maybe_redirect_for_registration]
-# Permission dotLRN
if {![dotlrn::user_p -user_id $user_id]} {
ad_returnredirect "index-not-a-user"
ad_script_abort
}
-if {![dotlrn::user_can_browse_p]} {
- # Figure out if the user is a member of a community
- set communities [dotlrn_community::get_all_communities_by_user $user_id]
+set communities [dotlrn_community::get_all_communities_by_user $user_id]
- # If no communities
+set access_level [db_string select_users_access_level {
+ select access_level
+ from dotlrn_users
+ where user_id = :user_id
+}]
+
+if {[string match $access_level limited] && [llength $communities] == 1} {
+ ad_returnredirect [dotlrn_community::get_url_from_package_id \
+ -package_id [ns_set get [lindex $communities 0] package_id] \
+ ]
+ ad_script_abort
+}
+
+if {![dotlrn::user_can_browse_p -user_id $user_id]} {
+
if {[llength $communities] == 0} {
ad_returnredirect "index-not-a-user"
ad_script_abort
- }
-
- # If just one community
- if {[llength $communities] == 1} {
- ad_returnredirect \
- [dotlrn_community::get_url_from_package_id \
- -package_id [lindex [lindex $communities 0] 4] \
- ]
+ } elseif {[llength $communities] == 1} {
+ ad_returnredirect [dotlrn_community::get_url_from_package_id \
+ -package_id [ns_set get [lindex $communities 0] package_id] \
+ ]
ad_script_abort
}
- # If more than one
ad_return_template index-no-browse
return
}
set portal_id [dotlrn::get_portal_id -user_id $user_id]
+set rendered_page [dotlrn::render_page -page_num $page_num -hide_links_p t $portal_id]
-set rendered_page \
- [dotlrn::render_page \
- -page_num $page_num \
- -hide_links_p "t" \
- $portal_id \
- ]
-
ad_return_template
Index: openacs-4/packages/dotlrn/www/my-communities.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/my-communities.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/dotlrn/www/my-communities.tcl 21 May 2002 07:46:03 -0000 1.5
+++ openacs-4/packages/dotlrn/www/my-communities.tcl 28 May 2002 21:57:05 -0000 1.6
@@ -26,7 +26,7 @@
}
set user_id [ad_maybe_redirect_for_registration]
-set user_can_browse_p [dotlrn::user_can_browse_p]
+set user_can_browse_p [dotlrn::user_can_browse_p -user_id $user_id]
if {![info exists referer]} {
set referer "my-communities"
Index: openacs-4/packages/dotlrn/www/preferences.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/preferences.adp,v
diff -u -r1.16 -r1.17
--- openacs-4/packages/dotlrn/www/preferences.adp 22 May 2002 03:42:32 -0000 1.16
+++ openacs-4/packages/dotlrn/www/preferences.adp 28 May 2002 21:57:05 -0000 1.17
@@ -26,6 +26,7 @@
0