Index: openacs-4/packages/dotlrn/tcl/class-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/class-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/dotlrn/tcl/class-procs.tcl 29 Nov 2001 02:23:20 -0000 1.11 +++ openacs-4/packages/dotlrn/tcl/class-procs.tcl 29 Nov 2001 05:10:36 -0000 1.12 @@ -93,9 +93,13 @@ # Insert the class instance set community_id [db_exec_plsql create_class_instance {}] + # Set up the rel segments + dotlrn_community::create_rel_segments -community_id $community_id + # Set up the node - # set parent_node_id [ad_conn -get node_id] # THIS IS WRONG: the parent_node_id is the node of the class_type + # set parent_node_id [ad_conn -get node_id] + # So instead we DO THIS: set parent_node_id [db_string select_parent_node_id {}] # Instantiate the right package at that site node, probably portals 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.25 -r1.26 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 26 Nov 2001 22:02:12 -0000 1.25 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 29 Nov 2001 05:10:36 -0000 1.26 @@ -52,6 +52,9 @@ # Create the community set community_id [db_exec_plsql create_community {}] + # Rel segments + create_rel_segments -community_id $community_id + return $community_id } @@ -141,6 +144,59 @@ return $pretty_name } + ad_proc -public get_rel_segment_id { + {-community_id:required} + {-rel_type:required} + } { + get the relational segment ID for a community and a rel type + } { + return [db_string select_rel_segment_id {} -default ""] + } + + ad_proc -public create_rel_segments { + {-community_id:required} + } { + create all the relational segments for a community + } { + # Get some information about the community + set community_name [get_community_name $community_id] + + db_transaction { + # Go through the allowed rel types + foreach rel_type [get_allowed_rel_types -community_id $community_id] { + set rel_type_key [lindex $rel_type 0] + set rel_type_name [lindex $rel_type 1] + set name "${rel_type_name}s for $community_name" + + # Create the segment + rel_segments_new $community_id $rel_type_key $name + } + } + } + + ad_proc -public delete_rel_segments { + {-community_id:required} + } { + remove the rel segments for a community + } { + set rel_types [get_allowed_rel_types -community_id $community_id] + set segment_ids [list] + + # Collect the segment IDs + foreach rel_type $rel_types { + lappend segment_ids [get_rel_segment_id -community_id $community_id -rel_type [lindex $rel_type 0]] + } + + db_transaction { + # Go through the segment IDs + foreach segment_id $segment_ids { + # Delete the segment + rel_segments_delete $segment_id + } + } + } + + ad_proc -public list_admin_users { community_id } { Index: openacs-4/packages/dotlrn/tcl/community-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.xql,v diff -u -r1.12 -r1.13 --- openacs-4/packages/dotlrn/tcl/community-procs.xql 28 Nov 2001 00:22:47 -0000 1.12 +++ openacs-4/packages/dotlrn/tcl/community-procs.xql 29 Nov 2001 05:10:36 -0000 1.13 @@ -17,19 +17,15 @@ - - + -insert into dotlrn_communities -(community_id, community_type, community_key, pretty_name, description) -values -(:community_id, :community_type, :name, :pretty_name, :description) +update dotlrn_communities set package_id= :package_id where community_id= :community_id - + -update dotlrn_communities set package_id= :package_id where community_id= :community_id +select segment_id from rel_segments where group_id= :community_id and rel_type= :rel_type 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.6 -r1.7 --- openacs-4/packages/dotlrn/tcl/dotlrn-security-procs.tcl 27 Nov 2001 23:32:03 -0000 1.6 +++ openacs-4/packages/dotlrn/tcl/dotlrn-security-procs.tcl 29 Nov 2001 05:10:36 -0000 1.7 @@ -22,6 +22,7 @@ ad_proc -private do_abort {} { do an abort if security violation } { + ad_returnredirect "not-allowed" return -code error } @@ -42,6 +43,8 @@ # Update the user and set the portal page correctly db_dml update_user_page_id {} + + # FIXME: what do we do about permissions? } } @@ -76,6 +79,8 @@ # Subscribe the guest to that community dotlrn_community::add_user $community_id $user_id + + # FIXME: what do we do about permissions? } } @@ -109,7 +114,9 @@ } { Require that a user be able to browse dotLRN } { - + if {![user_can_browse_p -user_id $user_id]} { + do_abort + } } ad_proc -public user_can_read_sensitive_data_p { @@ -133,6 +140,9 @@ } { Require that a user be able to read sensitive data } { + if {![user_can_read_sensitive_data_p -user_id $user_id]} { + do_abort + } } ad_proc -public user_can_read_community_type_p { @@ -141,6 +151,8 @@ } { Check if a user can read a community type } { + # FIXME: permission hack + return 1 } ad_proc -public require_user_read_community_type { @@ -149,6 +161,9 @@ } { require that a user be able to read a community type } { + if {![user_can_read_community_type_p -user_id $user_id $community_type]} { + do_abort + } } ad_proc -public user_can_read_community_p { @@ -157,6 +172,7 @@ } { Check if a user can read a community } { + return [ad_permission_p -user_id $user_id $community_id dotlrn_view_community] } ad_proc -public require_user_read_community { @@ -165,6 +181,9 @@ } { require that a user be able to read a community } { + if {![user_can_read_community_p -user_id $user_id $community_id]} { + do_abort + } } ad_proc -public user_is_community_member_p { @@ -173,6 +192,8 @@ } { check if a user is a member of a community } { + # FIXME: security hack + return 1 } ad_proc -public require_user_community_member { @@ -181,6 +202,9 @@ } { require that a user be member of a particular community } { + if {![user_is_community_member_p -user_id $user_id $community_id]} { + do_abort + } } ad_proc -public user_can_admin_community_p { @@ -189,8 +213,7 @@ } { check if a user can admin a community } { - # FIXME - return 1 + return [ad_permission_p -user_id $user_id $community_id dotlrn_admin_community] } ad_proc -public require_user_admin_community {