aboutsummaryrefslogtreecommitdiff
path: root/GradeBook.tcl
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2010-12-15 16:01:22 -0500
committerEugeniy Mikhailov <evgmik@gmail.com>2010-12-15 16:01:22 -0500
commit9bffd28bb1f659882877a04e05d3bedf34f18344 (patch)
treed5c770da83d8ecd48df3a10441c05d1f5c4eef39 /GradeBook.tcl
parente1b5d933c9fb496c460d622998ccbdd9d92b7bdf (diff)
downloadGradeBook-9bffd28bb1f659882877a04e05d3bedf34f18344.tar.gz
GradeBook-9bffd28bb1f659882877a04e05d3bedf34f18344.zip
added authorization of the users
darcs-hash:20101215210122-067c0-f3b96811ca1f424557293c2ef6e8cacd9698e8f2.gz
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]
}