Index: openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl,v diff -u -r1.51 -r1.52 --- openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl 15 May 2002 22:13:57 -0000 1.51 +++ openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl 16 May 2002 05:17:09 -0000 1.52 @@ -239,14 +239,6 @@ return $node(object_id) } - ad_proc -public admin_p { - {-user_id ""} - } { - check if a user is admin for dotLRN - } { - return [permission::permission_p -party_id $user_id -object_id [dotlrn::get_package_id] -privilege "admin"] - } - ad_proc -public get_users_rel_segment_id {} { returns the rel_segment_id of the dotLRN users segment } { 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.40 -r1.41 --- openacs-4/packages/dotlrn/tcl/dotlrn-security-procs.tcl 15 May 2002 05:18:10 -0000 1.40 +++ openacs-4/packages/dotlrn/tcl/dotlrn-security-procs.tcl 16 May 2002 05:17:09 -0000 1.41 @@ -361,11 +361,7 @@ } { check if a user can admin a community } { - return [permission::permission_p \ - -party_id $user_id \ - -object_id $community_id \ - -privilege "dotlrn_admin_community" \ - ] + return [permission::permission_p -party_id $user_id -object_id $community_id -privilege dotlrn_admin_community] } ad_proc -public require_user_admin_community { @@ -379,4 +375,22 @@ } } + ad_proc -public admin_p { + {-user_id ""} + } { + check if a user is admin for dotLRN + } { + return [permission::permission_p -party_id $user_id -object_id [dotlrn::get_package_id] -privilege admin] + } + + ad_proc -public require_admin { + {-user_id ""} + } { + require that a user have admin privileges on all of dotlrn + } { + if {![admin_p -user_id $user_id]} { + do_abort + } + } + } 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.16 -r1.17 --- openacs-4/packages/dotlrn/www/user-add.tcl 2 May 2002 21:00:05 -0000 1.16 +++ openacs-4/packages/dotlrn/www/user-add.tcl 16 May 2002 05:17:09 -0000 1.17 @@ -34,11 +34,16 @@ } set user_id [ad_maybe_redirect_for_registration] +set community_id [dotlrn_community::get_community_id] -dotlrn::require_user_admin_community [dotlrn_community::get_community_id] +if {![empty_string_p $community_id]} { + dotlrn::require_user_admin_community [dotlrn_community::get_community_id] + set context_bar {{"one-community-admin" Admin} {Add User}} +} else { + dotlrn::require_admin + set context_bar {{users Users} {Add User}} +} -set context_bar {{"one-community-admin" Admin} {Add User}} - set target_user_id [db_nextval acs_object_id_seq] form create add_user @@ -97,7 +102,7 @@ -value $access_level element create add_user read_private_data_p \ - -label "Can Read Private Data?" \ + -label "Guest?" \ -datatype text \ -widget hidden \ -value $read_private_data_p @@ -117,10 +122,7 @@ if {![cc_email_from_party $target_user_id]} { # create the ACS user set password [ad_generate_random_string] - set target_user_id [ad_user_new \ - $email $first_names $last_name $password \ - "" "" "" "t" "approved" $target_user_id \ - ] + set target_user_id [ad_user_new $email $first_names $last_name $password "" "" "" "t" "approved" $target_user_id] } # make the user a dotLRN user @@ -136,6 +138,7 @@ } else { ad_returnredirect $redirect } + ad_script_abort } 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.20 -r1.21 --- openacs-4/packages/dotlrn/www/admin/user-new-2.tcl 29 Mar 2002 19:14:47 -0000 1.20 +++ openacs-4/packages/dotlrn/www/admin/user-new-2.tcl 16 May 2002 05:17:09 -0000 1.21 @@ -25,6 +25,14 @@ {referer "/dotlrn/admin/users"} } +db_1row select_user_info { + select email, + first_names, + last_name + from registered_users + where user_id = :user_id +} + form create add_user element create add_user user_id \ @@ -38,6 +46,7 @@ -datatype text \ -widget text \ -html {size 30} \ + -value email \ -optional element create add_user type \ @@ -79,13 +88,6 @@ return } -db_1row select_user_info { - select first_names, - last_name - from registered_users - where user_id = :user_id -} - set context_bar {{users Users} New} ad_return_template