diff options
-rwxr-xr-x | AddDummyUsers2db.tcl | 12 | ||||
-rwxr-xr-x | CreateCourseGradeBook.tcl | 19 | ||||
-rwxr-xr-x | GradeBook.tcl | 2 | ||||
-rwxr-xr-x | GradeBook_lib.tcl | 25 | ||||
-rwxr-xr-x | csv2GradeBook.tcl | 6 |
5 files changed, 30 insertions, 34 deletions
diff --git a/AddDummyUsers2db.tcl b/AddDummyUsers2db.tcl index 2861b45..a03f728 100755 --- a/AddDummyUsers2db.tcl +++ b/AddDummyUsers2db.tcl @@ -18,12 +18,12 @@ sqlite3 db $dbfile #AddUserNonWeb first_name last_name user_name password_hash group_name id_number section_num i # dummy users -#AddUserNonWeb Ins "Instruch I" instructor [::md5::md5 -hex qwerty] instructor -AddUserNonWeb Ta "Taevich, I" ta [::md5::md5 -hex qwerty] ta -AddUserNonWeb Dan "Dandanovich" dan [::md5::md5 -hex qwerty] student -AddUserNonWeb Ale "Alevna" ale [::md5::md5 -hex qwerty] student -AddUserNonWeb Jon "Jonovich" jon [::md5::md5 -hex qwerty] student -AddUserNonWeb Ale "Alevna" ale {} student +#AddUserNonWeb Ins "Instruch I" instructor instructor +AddUserNonWeb Ta "Taevich, I" ta ta +AddUserNonWeb Dan "Dandanovich" dan student +AddUserNonWeb Ale "Alevna" ale student +AddUserNonWeb Jon "Jonovich" jon student +AddUserNonWeb Ale "Alevna" ale student diff --git a/CreateCourseGradeBook.tcl b/CreateCourseGradeBook.tcl index 4190bb7..4df9456 100755 --- a/CreateCourseGradeBook.tcl +++ b/CreateCourseGradeBook.tcl @@ -7,24 +7,23 @@ package require sqlite3 package require md5 source ./GradeBook_lib.tcl -if { $argc < 3 } { +if { $argc < 2 } { puts {Usage:} - puts "$argv0 database_name instructor_login instructor_password \[instructor_fname\] \[instructor_lname\]" + puts "$argv0 database_name instructor_login \[instructor_fname\] \[instructor_lname\]" exit } set dbfile [lindex $argv 0] set instructor_login [lindex $argv 1] -set instructor_password [lindex $argv 2] -if { $argc >= 4 } { - set instructor_fname [lindex $argv 3] +if { $argc >= 3 } { + set instructor_fname [lindex $argv 2] } else { set instructor_fname {} } -if { $argc >= 5 } { - set instructor_lname [lindex $argv 4] +if { $argc >= 4 } { + set instructor_lname [lindex $argv 3] } else { set instructor_lname {} } @@ -37,11 +36,11 @@ CreateGradesTable db CreateAccessRightsTable db CreateGradesCategoryTable db -#AddUserNonWeb first_name last_name user_name password_hash group_name id_number section_num i -AddUserNonWeb $instructor_fname $instructor_lname $instructor_login [::md5::md5 -hex $instructor_password] instructor +#AddUserNonWeb first_name last_name user_name group_name id_number section_num i +AddUserNonWeb $instructor_fname $instructor_lname $instructor_login instructor # reasonable defaults for hidden columns -set instructor_hidden_columns [list UserHiddenColums PasswordHash UserHiddenGroups IdNum] +set instructor_hidden_columns [list UserHiddenColums UserHiddenGroups IdNum] UpdateColValue4GroupNameNonWeb UserHiddenColums instructor $instructor_hidden_columns # vim: ts=2 sw=2 foldmethod=indent: diff --git a/GradeBook.tcl b/GradeBook.tcl index 4500cd1..6b69655 100755 --- a/GradeBook.tcl +++ b/GradeBook.tcl @@ -76,7 +76,7 @@ if { [file exists $dbfile] && ("$coursedbfname" ne "") } { htmlHeader puts "<body>" sqlite3 db $dbfile - set permission_list [AccessGroupRights db $user $password] + set permission_list [ AccessGroupRights db $user ] htmlTop $permission_list ChoseAction $action $permission_list $user db close diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index 9161891..1f5670b 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -334,8 +334,8 @@ proc ColName2SqlSafeForm {colname} { return $colname } -proc AddUserNonWeb { first_name last_name user_name password_hash {group_name {guest}} {id_number {}} {section_num {} } } { - set eval_str [concat INSERT INTO GradesTable (FirstName, LastName, UserName, PasswordHash, GroupName, IdNum, SectionNum) VALUES('$first_name', '$last_name', '$user_name', '$password_hash', '$group_name', '$id_number', '$section_num')] +proc AddUserNonWeb { first_name last_name user_name {group_name {guest}} {id_number {}} {section_num {} } } { + set eval_str [concat INSERT INTO GradesTable (FirstName, LastName, UserName, GroupName, IdNum, SectionNum) VALUES('$first_name', '$last_name', '$user_name', '$group_name', '$id_number', '$section_num')] set err [catch {db eval $eval_str } errStat] if { $err } { htmlErrorMsg $errStat @@ -396,7 +396,6 @@ proc GetDefaultGradesTableColumn {} { FirstName text\ LastName text\ UserName text\ - PasswordHash text\ GroupName text\ UserHiddenColums text\ UserHiddenGroups text\ @@ -570,12 +569,12 @@ proc CreateGradesTable {db} { } # add special users aka special info rows - AddUserNonWeb {} {} _Col_Category_ {} inforow - AddUserNonWeb {} {} _Max_Points_ {} inforow - AddUserNonWeb {} {} _Visible_To_Students_ {} inforow + AddUserNonWeb {} {} _Col_Category_ inforow + AddUserNonWeb {} {} _Max_Points_ inforow + AddUserNonWeb {} {} _Visible_To_Students_ inforow # reasonable defaults for hidden columns - #set instructor_hidden_columns [list UserHiddenColums PasswordHash UserHiddenGroups IdNum] + #set instructor_hidden_columns [list UserHiddenColums UserHiddenGroups IdNum] #UpdateColValue4GroupNameNonWeb UserHiddenColums instructor $instructor_hidden_columns } @@ -710,9 +709,9 @@ proc htmlDBout {db permission_list user {sort_col {}}} { # set hidden column list switch $permission(GroupName) { instructor { set hidden_columns {} } - ta { set hidden_columns [list UserName PasswordHash GroupName UserHiddenColums UserHiddenGroups UserHiddenGradeCategories IdNum] } - student { set hidden_columns [list UserName PasswordHash GroupName UserHiddenColums UserHiddenGroups UserHiddenGradeCategories IdNum SectionNum] } - dropped { set hidden_columns [list UserName PasswordHash GroupName UserHiddenColums UserHiddenGroups UserHiddenGradeCategories IdNum SectionNum] } + ta { set hidden_columns [list UserName GroupName UserHiddenColums UserHiddenGroups UserHiddenGradeCategories IdNum] } + student { set hidden_columns [list UserName GroupName UserHiddenColums UserHiddenGroups UserHiddenGradeCategories IdNum SectionNum] } + dropped { set hidden_columns [list UserName GroupName UserHiddenColums UserHiddenGroups UserHiddenGradeCategories IdNum SectionNum] } guest { set hidden_columns $column_list } default { set hidden_columns $column_list } } @@ -791,7 +790,6 @@ proc htmlDBout {db permission_list user {sort_col {}}} { FirstName { lappend action_list changefirstname } LastName { lappend action_list changelastname } UserName { lappend action_list changeusername } - PasswordHash { } UserHiddenColums { } UserHiddenGroups { } UserHiddenGradeCategories { } @@ -1349,7 +1347,7 @@ proc AddNewUserInfo {db permission_list user } { 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 + AddUserNonWeb $first_name $last_name $login $group_name $id_number $section_number } } @@ -1882,9 +1880,8 @@ proc Authenticate_User { user_requested password } { return $user } -proc AccessGroupRights {db user password } { +proc AccessGroupRights {db user } { dbg "access rights check for user: $user" msg_level_info - set PasswordHash [::md5::md5 -hex $password] set eval_str [list SELECT GroupName FROM GradesTable WHERE UserName='$user'] db eval $eval_str group_name_array {} if { [ info exist group_name_array(GroupName) ] } { diff --git a/csv2GradeBook.tcl b/csv2GradeBook.tcl index e5bf814..01e2d17 100755 --- a/csv2GradeBook.tcl +++ b/csv2GradeBook.tcl @@ -30,8 +30,8 @@ proc htmlErrorMsg { msg } { puts "<div class=\"errormsg\">error: $msg</div>" } -proc AddUserNonWeb { first_name last_name user_name password_hash {group_name {guest}} {id_number {}} {section_num {} } } { - set eval_str [concat INSERT INTO GradesTable (FirstName, LastName, UserName, PasswordHash, GroupName, IdNum, SectionNum) VALUES('$first_name', '$last_name', '$user_name', '$password_hash', '$group_name', '$id_number', '$section_num')] +proc AddUserNonWeb { first_name last_name user_name {group_name {guest}} {id_number {}} {section_num {} } } { + set eval_str [concat INSERT INTO GradesTable (FirstName, LastName, UserName, GroupName, IdNum, SectionNum) VALUES('$first_name', '$last_name', '$user_name', '$group_name', '$id_number', '$section_num')] set err [catch {db eval $eval_str } errStat] if { $err } { htmlErrorMsg $errStat @@ -56,7 +56,7 @@ while {-1 != [gets $fp line]} { set sect [lindex $data 3] set email [lindex $data 4] #puts "$fname $lname $email {} student $id $sect" - AddUserNonWeb $fname $lname $email {} student $id $sect + AddUserNonWeb $fname $lname $email student $id $sect } |