aboutsummaryrefslogtreecommitdiff
path: root/GradeBook.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'GradeBook.tcl')
-rwxr-xr-xGradeBook.tcl17
1 files changed, 11 insertions, 6 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl
index a9d00cc..ba25520 100755
--- a/GradeBook.tcl
+++ b/GradeBook.tcl
@@ -1,6 +1,6 @@
#!/bin/sh
# FILE: "/home/evmik/src/my_src/GradeBook/GradeBook.tcl"
-# LAST MODIFICATION: "Wed, 15 Dec 2010 14:55:38 -0500 (evmik)"
+# LAST MODIFICATION: "Wed, 15 Dec 2010 16:01:20 -0500 (evmik)"
# (C) 2010 by Eugeniy Mikhailov, <evgmik@gmail.com>
# $Id:$
# vim:set ft=tcl: \
@@ -214,15 +214,20 @@ proc ChoseAction {action permission_list} {
proc AccessGroupRights {db user password } {
dbg "access rights check for user: $user"
- if { $user == "guest"} {
- set group guest
+ set PasswordHash [::md5::md5 -hex $password]
+ set eval_str [list SELECT GroupName FROM PasswordsTable WHERE UserName='$user' AND PasswordHash='$PasswordHash']
+ db eval $eval_str group_name_array {}
+ set name_found [array names group_name_array -exact GroupName]
+ if { $name_found != ""} {
+ set group $group_name_array(GroupName);
} else {
- set group instructor
+ set group guest
}
- set eval_str [list SELECT * FROM AccessRightsTable WHERE GroupName == '$group']
+ dbg "Detected group is $group"
+ set eval_str [list SELECT * FROM AccessRightsTable WHERE GroupName='$group']
db eval $eval_str permissions {}
array unset permissions {\*}
- dbg "permissions for user $user are: [array get permissions]"
+ dbg "permissions for user $user belonging to the group $group are: [array get permissions]"
return [array get permissions]
}