From c447b05000cd8ca3f0501712de11e79265ce3720 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Tue, 25 Jan 2011 12:19:40 -0500 Subject: checked validity conditions for new user to be added Ignore-this: 7bd88c9d4475c3aacb602edfe0660d1f darcs-hash:20110125171940-067c0-f274692c58e223591c657dfbe72ddc635bd59904.gz --- GradeBook_lib.tcl | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index afb2d46..238bb17 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -466,7 +466,23 @@ proc AddNewUserInfo {db permission_list user } { if { $subaction eq "Cancel" } { return } + + if { $login eq "" } { + htmlErrorMsg "Empty login names are not permitted" + return + } + + if { [SelectColValue4User UserName $login] ne "" } { + htmlErrorMsg "User with login $login already exists" + return + } + + set permitted_groups [list instructor ta student guest] if { $subaction eq "Submit" } { + if { $group_name ni $permitted_groups } { + htmlInfoMsg "Unknown group name {$group_name} replaced with {guest}." + set group_name guest + } AddUserNonWeb $first_name $last_name $login {} $group_name $id_number $section_number } } @@ -478,7 +494,7 @@ proc EditNewUserInfo {db permission_list user } { puts "
" puts "First Name:
" puts "Last Name:
" - puts "Login:
" + puts "Login (email):
" puts "Id Number:
" puts "Section Number:
" puts "Group Name:
" -- cgit v1.2.3