Index: openacs-4/packages/dotlrn/sql/oracle/admins-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/admins-package-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/oracle/admins-package-create.sql 6 May 2002 23:55:01 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/oracle/admins-package-create.sql 2 Jun 2002 00:05:56 -0000 1.2 @@ -27,7 +27,6 @@ rel_id in dotlrn_admin_profile_rels.rel_id%TYPE default null, user_id in users.user_id%TYPE, portal_id in dotlrn_user_profile_rels.portal_id%TYPE, - access_level in dotlrn_user_profile_rels.access_level%TYPE, theme_id in dotlrn_user_profile_rels.theme_id%TYPE default null, id in dotlrn_user_profile_rels.id%TYPE default null, rel_type in acs_rels.rel_type%TYPE default 'dotlrn_admin_profile_rel', @@ -50,7 +49,6 @@ rel_id in dotlrn_admin_profile_rels.rel_id%TYPE default null, user_id in users.user_id%TYPE, portal_id in dotlrn_user_profile_rels.portal_id%TYPE, - access_level in dotlrn_user_profile_rels.access_level%TYPE, theme_id in dotlrn_user_profile_rels.theme_id%TYPE default null, id in dotlrn_user_profile_rels.id%TYPE default null, rel_type in acs_rels.rel_type%TYPE default 'dotlrn_admin_profile_rel', @@ -77,7 +75,6 @@ rel_id => rel_id, user_id => user_id, portal_id => portal_id, - access_level => access_level, theme_id => theme_id, id => id, rel_type => rel_type, Index: openacs-4/packages/dotlrn/sql/oracle/externals-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/externals-package-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/oracle/externals-package-create.sql 6 May 2002 23:55:01 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/oracle/externals-package-create.sql 2 Jun 2002 00:05:56 -0000 1.2 @@ -27,7 +27,6 @@ rel_id in dotlrn_external_profile_rels.rel_id%TYPE default null, user_id in users.user_id%TYPE, portal_id in dotlrn_user_profile_rels.portal_id%TYPE, - access_level in dotlrn_user_profile_rels.access_level%TYPE, theme_id in dotlrn_user_profile_rels.theme_id%TYPE default null, id in dotlrn_user_profile_rels.id%TYPE default null, rel_type in acs_rels.rel_type%TYPE default 'dotlrn_external_profile_rel', @@ -50,7 +49,6 @@ rel_id in dotlrn_external_profile_rels.rel_id%TYPE default null, user_id in users.user_id%TYPE, portal_id in dotlrn_user_profile_rels.portal_id%TYPE, - access_level in dotlrn_user_profile_rels.access_level%TYPE, theme_id in dotlrn_user_profile_rels.theme_id%TYPE default null, id in dotlrn_user_profile_rels.id%TYPE default null, rel_type in acs_rels.rel_type%TYPE default 'dotlrn_external_profile_rel', @@ -77,7 +75,6 @@ rel_id => rel_id, user_id => user_id, portal_id => portal_id, - access_level => access_level, theme_id => theme_id, id => id, rel_type => rel_type, Index: openacs-4/packages/dotlrn/sql/oracle/professors-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/professors-package-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/oracle/professors-package-create.sql 6 May 2002 23:55:01 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/oracle/professors-package-create.sql 2 Jun 2002 00:05:56 -0000 1.2 @@ -27,7 +27,6 @@ rel_id in dotlrn_professor_profile_rels.rel_id%TYPE default null, user_id in users.user_id%TYPE, portal_id in dotlrn_user_profile_rels.portal_id%TYPE, - access_level in dotlrn_user_profile_rels.access_level%TYPE, theme_id in dotlrn_user_profile_rels.theme_id%TYPE default null, id in dotlrn_user_profile_rels.id%TYPE default null, rel_type in acs_rels.rel_type%TYPE default 'dotlrn_professor_profile_rel', @@ -50,7 +49,6 @@ rel_id in dotlrn_professor_profile_rels.rel_id%TYPE default null, user_id in users.user_id%TYPE, portal_id in dotlrn_user_profile_rels.portal_id%TYPE, - access_level in dotlrn_user_profile_rels.access_level%TYPE, theme_id in dotlrn_user_profile_rels.theme_id%TYPE default null, id in dotlrn_user_profile_rels.id%TYPE default null, rel_type in acs_rels.rel_type%TYPE default 'dotlrn_professor_profile_rel', @@ -77,7 +75,6 @@ rel_id => rel_id, user_id => user_id, portal_id => portal_id, - access_level => access_level, theme_id => theme_id, id => id, rel_type => rel_type, Index: openacs-4/packages/dotlrn/sql/oracle/students-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/students-package-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/oracle/students-package-create.sql 6 May 2002 23:55:01 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/oracle/students-package-create.sql 2 Jun 2002 00:05:56 -0000 1.2 @@ -27,7 +27,6 @@ rel_id in dotlrn_student_profile_rels.rel_id%TYPE default null, user_id in users.user_id%TYPE, portal_id in dotlrn_user_profile_rels.portal_id%TYPE, - access_level in dotlrn_user_profile_rels.access_level%TYPE, theme_id in dotlrn_user_profile_rels.theme_id%TYPE default null, id in dotlrn_user_profile_rels.id%TYPE default null, rel_type in acs_rels.rel_type%TYPE default 'dotlrn_student_profile_rel', @@ -50,7 +49,6 @@ rel_id in dotlrn_student_profile_rels.rel_id%TYPE default null, user_id in users.user_id%TYPE, portal_id in dotlrn_user_profile_rels.portal_id%TYPE, - access_level in dotlrn_user_profile_rels.access_level%TYPE, theme_id in dotlrn_user_profile_rels.theme_id%TYPE default null, id in dotlrn_user_profile_rels.id%TYPE default null, rel_type in acs_rels.rel_type%TYPE default 'dotlrn_student_profile_rel', @@ -77,7 +75,6 @@ rel_id => rel_id, user_id => user_id, portal_id => portal_id, - access_level => access_level, theme_id => theme_id, id => id, rel_type => rel_type, Index: openacs-4/packages/dotlrn/sql/oracle/users-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/users-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn/sql/oracle/users-create.sql 16 May 2002 13:37:42 -0000 1.2 +++ openacs-4/packages/dotlrn/sql/oracle/users-create.sql 2 Jun 2002 00:05:56 -0000 1.3 @@ -32,11 +32,6 @@ not null, theme_id constraint dotlrn_user_p_rels_theme_id_fk references portal_element_themes (theme_id), - access_level varchar(100) - constraint dotlrn_user_p_rels_access_ck - check (access_level in ('full', 'limited')) - constraint dotlrn_user_p_rels_access_nn - not null, id varchar(200) ); @@ -56,7 +51,6 @@ select acs_rels.rel_id, dotlrn_user_profile_rels.portal_id, dotlrn_user_profile_rels.theme_id, - dotlrn_user_profile_rels.access_level, dotlrn_user_profile_rels.id, users.user_id, persons.first_names, Index: openacs-4/packages/dotlrn/sql/oracle/users-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/users-package-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/oracle/users-package-create.sql 6 May 2002 23:55:01 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/oracle/users-package-create.sql 2 Jun 2002 00:05:56 -0000 1.2 @@ -27,7 +27,6 @@ rel_id in dotlrn_user_profile_rels.rel_id%TYPE default null, user_id in users.user_id%TYPE, portal_id in dotlrn_user_profile_rels.portal_id%TYPE, - access_level in dotlrn_user_profile_rels.access_level%TYPE, theme_id in dotlrn_user_profile_rels.theme_id%TYPE default null, id in dotlrn_user_profile_rels.id%TYPE default null, rel_type in acs_rels.rel_type%TYPE default 'dotlrn_user_profile_rel', @@ -50,7 +49,6 @@ rel_id in dotlrn_user_profile_rels.rel_id%TYPE default null, user_id in users.user_id%TYPE, portal_id in dotlrn_user_profile_rels.portal_id%TYPE, - access_level in dotlrn_user_profile_rels.access_level%TYPE, theme_id in dotlrn_user_profile_rels.theme_id%TYPE default null, id in dotlrn_user_profile_rels.id%TYPE default null, rel_type in acs_rels.rel_type%TYPE default 'dotlrn_user_profile_rel', @@ -84,9 +82,9 @@ insert into dotlrn_user_profile_rels - (rel_id, portal_id, theme_id, access_level, id) + (rel_id, portal_id, theme_id, id) values - (v_rel_id, portal_id, theme_id, access_level, id); + (v_rel_id, portal_id, theme_id, id); return v_rel_id; end; Index: openacs-4/packages/dotlrn/tcl/dotlrn-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/dotlrn-init.tcl,v diff -u -r1.24 -r1.25 --- openacs-4/packages/dotlrn/tcl/dotlrn-init.tcl 30 May 2002 22:04:59 -0000 1.24 +++ openacs-4/packages/dotlrn/tcl/dotlrn-init.tcl 2 Jun 2002 00:05:56 -0000 1.25 @@ -41,7 +41,7 @@ -parent_node_id [site_node_id "/"] \ -package_key $portal_package_key \ -url $portal_mount_point \ - -directory_p "t" + -directory_p t } db_transaction { @@ -59,7 +59,7 @@ # called repeatedly since this script is eval'd at every server startup foreach applet [dotlrn_community::list_applets] { # Callback on all applets - dotlrn_community::applet_call $applet "AddApplet" [list] + dotlrn_community::applet_call $applet AddApplet [list] } ns_log notice "dotlrn-init: dotlrn is instantiated, about to call dotlrn::init" @@ -77,16 +77,11 @@ ns_log notice "dotlrn-init: done with dotlrn_club::init" # Grantee - set grantee_id [dotlrn::get_users_rel_segment_id] set package_id [dotlrn::get_package_id] - - # Grant the permission - permission::grant -party_id $grantee_id -object_id $package_id -privilege "dotlrn_browse" - - # check read permission on dotLRN for all users set grantee_id [dotlrn::get_users_rel_segment_id] - permission::grant -party_id $grantee_id -object_id $package_id -privilege "read" + permission::grant -party_id $grantee_id -object_id $package_id -privilege read + } } 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.44 -r1.45 --- openacs-4/packages/dotlrn/tcl/dotlrn-security-procs.tcl 28 May 2002 21:57:05 -0000 1.44 +++ openacs-4/packages/dotlrn/tcl/dotlrn-security-procs.tcl 2 Jun 2002 00:05:56 -0000 1.45 @@ -99,8 +99,8 @@ } ad_proc -public user_add { - {-type "student"} - {-access_level "limited"} + {-type student} + {-can_browse:boolean} {-id ""} {-user_id:required} } { @@ -119,14 +119,13 @@ # set up extra vars set extra_vars [ns_set create] ns_set put $extra_vars user_id $user_id - ns_set put $extra_vars access_level $access_level ns_set put $extra_vars id $id - set template_id [dotlrn::get_portal_id_from_type \ - -type "user" - ] + set template_id [dotlrn::get_portal_id_from_type -type user] db_transaction { + set_can_browse -user_id $user_id -can_browse\=$can_browse_p + set portal_id [portal::create \ -template_id $template_id \ -name "Your dotLRN Workspace" \ @@ -230,6 +229,25 @@ return [db_string select_user_type {} -default ""] } + ad_proc -public set_can_browse { + {-user_id ""} + {-can_browse:boolean} + } { + sets whether a user can browse communities + } { + if {$can_browse_p} { + permission::grant \ + -party_id $user_id \ + -object_id [dotlrn::get_package_id] \ + -privilege dotlrn_browse + } else { + permission::revoke \ + -party_id $user_id \ + -object_id [dotlrn::get_package_id] \ + -privilege dotlrn_browse + } + } + ad_proc -public user_can_browse_p { {-user_id ""} } { @@ -238,7 +256,7 @@ return [permission::permission_p \ -party_id $user_id \ -object_id [dotlrn::get_package_id] \ - -privilege "dotlrn_browse" \ + -privilege dotlrn_browse \ ] } Index: openacs-4/packages/dotlrn/tcl/dotlrn-user-extension-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/dotlrn-user-extension-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn/tcl/dotlrn-user-extension-procs.tcl 21 May 2002 17:30:02 -0000 1.5 +++ openacs-4/packages/dotlrn/tcl/dotlrn-user-extension-procs.tcl 2 Jun 2002 00:05:56 -0000 1.6 @@ -54,7 +54,7 @@ foreach pattern [automatic_email_patterns] { if {[string match $pattern $email]} { # create the dotLRN user now - dotlrn::user_add -type "student" -access_level "full" -user_id $user_id + dotlrn::user_add -type student -can_browse_p -user_id $user_id break } } Index: openacs-4/packages/dotlrn/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/index.tcl,v diff -u -r1.36 -r1.37 --- openacs-4/packages/dotlrn/www/index.tcl 29 May 2002 04:45:23 -0000 1.36 +++ openacs-4/packages/dotlrn/www/index.tcl 2 Jun 2002 00:05:56 -0000 1.37 @@ -41,18 +41,6 @@ } set communities [dotlrn_community::get_all_communities_by_user $user_id] - -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 [ns_set get [lindex $communities 0] url] - ad_script_abort -} - if {![dotlrn::user_can_browse_p -user_id $user_id]} { if {[llength $communities] == 0} { Index: openacs-4/packages/dotlrn/www/user-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/user-add.tcl,v diff -u -r1.21 -r1.22 --- openacs-4/packages/dotlrn/www/user-add.tcl 29 May 2002 04:45:23 -0000 1.21 +++ openacs-4/packages/dotlrn/www/user-add.tcl 2 Jun 2002 00:05:56 -0000 1.22 @@ -25,7 +25,7 @@ } -query { {id ""} {type student} - {access_level full} + {can_browse_p 1} {read_private_data_p t} {add_membership_p t} {referer members} @@ -95,11 +95,11 @@ -widget hidden \ -value $type -element create add_user access_level \ +element create add_user can_browse_p \ -label "Access Level" \ -datatype text \ -widget hidden \ - -value $access_level + -value $can_browse_p element create add_user read_private_data_p \ -label "Guest?" \ @@ -115,7 +115,7 @@ if {[form is_valid add_user]} { form get_values add_user \ - target_user_id id email first_names last_name referer type access_level read_private_data_p + target_user_id id email first_names last_name referer type can_browse_p read_private_data_p db_transaction { @@ -126,7 +126,7 @@ } # make the user a dotLRN user - dotlrn::user_add -id $id -type $type -access_level $access_level -user_id $target_user_id + dotlrn::user_add -id $id -type $type -can_browse\=$can_browse_p -user_id $target_user_id # can this user read private data? acs_privacy::set_user_read_private_data -user_id $target_user_id -object_id [dotlrn::get_package_id] -value $read_private_data_p Index: openacs-4/packages/dotlrn/www/admin/add-instructor-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/add-instructor-3.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/dotlrn/www/admin/add-instructor-3.tcl 29 Mar 2002 19:14:47 -0000 1.6 +++ openacs-4/packages/dotlrn/www/admin/add-instructor-3.tcl 2 Jun 2002 00:05:56 -0000 1.7 @@ -30,11 +30,11 @@ # if the user isn't already a dotLRN user make him so if {!${is_dotlrn_user}} { - dotlrn::user_add -type "professor" -access_level "full" -user_id $user_id - acs_privacy::set_user_read_private_data -user_id $user_id -object_id [dotlrn_community::get_package_id $community_id] -value "t" + dotlrn::user_add -user_id $user_id -type professor -can_browse + acs_privacy::set_user_read_private_data -user_id $user_id -object_id [dotlrn_community::get_package_id $community_id] -value t } # Add the relation -dotlrn_community::add_user -rel_type "dotlrn_instructor_rel" $community_id $user_id +dotlrn_community::add_user -rel_type dotlrn_instructor_rel $community_id $user_id ad_returnredirect $referer Index: openacs-4/packages/dotlrn/www/admin/user-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/user-edit-oracle.xql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/dotlrn/www/admin/user-edit-oracle.xql 28 Apr 2002 04:08:42 -0000 1.7 +++ openacs-4/packages/dotlrn/www/admin/user-edit-oracle.xql 2 Jun 2002 00:05:56 -0000 1.8 @@ -10,7 +10,6 @@ dotlrn_users.last_name, dotlrn_users.email, dotlrn_users.type, - dotlrn_users.access_level, acs_permission.permission_p(:dotlrn_package_id, :user_id, 'read_private_data') as read_private_data_p from dotlrn_users where dotlrn_users.user_id = :user_id Index: openacs-4/packages/dotlrn/www/admin/user-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/user-edit.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/dotlrn/www/admin/user-edit.tcl 29 May 2002 04:45:23 -0000 1.17 +++ openacs-4/packages/dotlrn/www/admin/user-edit.tcl 2 Jun 2002 00:05:56 -0000 1.18 @@ -30,6 +30,7 @@ set dotlrn_package_id [dotlrn::get_package_id] db_1row select_user_info {} +set can_browse_p [dotlrn::user_can_browse_p -user_id $user_id] form create edit_user @@ -40,7 +41,7 @@ -value $user_id element create edit_user id \ - -label "ID" \ + -label ID \ -datatype text \ -widget text \ -html {size 30} \ @@ -54,18 +55,18 @@ -options [dotlrn::get_user_types_as_options] \ -value $type -element create edit_user access_level \ +element create edit_user can_browse_p \ -label "Access Level" \ -datatype text \ -widget select \ - -options {{"Full" "full"} {"Limited" "limited"}} \ - -value $access_level + -options {{Full 1} {Limited 0}} \ + -value $can_browse_p element create edit_user read_private_data_p \ -label "Guest?" \ -datatype text \ -widget select \ - -options {{"No" "t"} {"Yes" "f"}} \ + -options {{No t} {Yes f}} \ -value $read_private_data_p element create edit_user return_url \ @@ -76,7 +77,7 @@ if {[form is_valid edit_user]} { form get_values edit_user \ - user_id id type access_level read_private_data_p return_url + user_id id type can_browse_p read_private_data_p return_url db_transaction { # remove the user @@ -86,7 +87,7 @@ dotlrn::user_add \ -id $id \ -type $type \ - -access_level $access_level \ + -can_browse\=$can_browse_p \ -user_id $user_id # Update permissions Index: openacs-4/packages/dotlrn/www/admin/user-new-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/user-new-2.tcl,v diff -u -r1.24 -r1.25 --- openacs-4/packages/dotlrn/www/admin/user-new-2.tcl 29 May 2002 04:45:23 -0000 1.24 +++ openacs-4/packages/dotlrn/www/admin/user-new-2.tcl 2 Jun 2002 00:05:56 -0000 1.25 @@ -58,11 +58,11 @@ -widget select \ -options [dotlrn::get_user_types_as_options] -element create add_user access_level \ +element create add_user can_browse_p \ -label "Access Level" \ -datatype text \ -widget select \ - -options {{"Full Access" full} {"Limited Access" limited}} + -options {{"Full Access" 1} {"Limited Access" 0}} element create add_user read_private_data_p \ -label "Guest?" \ @@ -78,17 +78,15 @@ if {[form is_valid add_user]} { form get_values add_user \ - user_id id type access_level read_private_data_p referer + user_id id type can_browse_p read_private_data_p referer db_transaction { - dotlrn::user_add -id $id -type $type -access_level $access_level -user_id $user_id + dotlrn::user_add -id $id -type $type -can_browse\=$can_browse_p -user_id $user_id acs_privacy::set_user_read_private_data -user_id $user_id -object_id [dotlrn::get_package_id] -value $read_private_data_p } ad_returnredirect $referer - # I don't think a script abort is the right thing (ben) - # ad_script_abort - return + ad_script_abort } set context_bar {{users Users} New} Index: openacs-4/packages/dotlrn/www/admin/user.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/user.adp,v diff -u -r1.13 -r1.14 --- openacs-4/packages/dotlrn/www/admin/user.adp 21 May 2002 17:30:02 -0000 1.13 +++ openacs-4/packages/dotlrn/www/admin/user.adp 2 Jun 2002 00:05:56 -0000 1.14 @@ -77,7 +77,7 @@

dotLRN Information

- +