aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2011-01-19 21:24:56 -0500
committerEugeniy Mikhailov <evgmik@gmail.com>2011-01-19 21:24:56 -0500
commiteef62c41022b1feb2e12bee35443490c45b70a53 (patch)
treedac460e771cb5021729d09979a7717ac9ecb7c76
parentbbe72022bf5514ca5fb5620b748455a64aa41cc1 (diff)
downloadGradeBook-eef62c41022b1feb2e12bee35443490c45b70a53.tar.gz
GradeBook-eef62c41022b1feb2e12bee35443490c45b70a53.zip
permission check is simplified
Ignore-this: e2c82d1cc96751dbf078929285eacad1 darcs-hash:20110120022456-067c0-38bc51de781ede8078bdd1f18599403cfb6811a5.gz
-rwxr-xr-xGradeBook.tcl13
1 files changed, 10 insertions, 3 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl
index 18c194d..dfc3410 100755
--- a/GradeBook.tcl
+++ b/GradeBook.tcl
@@ -251,13 +251,19 @@ proc isActionGranted { action permission_list user } {
array set permission $permission_list
if { $action == "defaultview" } {
# this one permitted to everyone
+ dbg "requested action $action for user $user is granted" 4
return 1;
}
- if { [info exist permission($action) ] && $permission($action) } {
- dbg "requested action $action is granted" 4
+ if { ![info exist permission($action) ] } {
+ dbg "requested UNKNOWN action $action for user $user is not granted" 0
+ return 0;
+ }
+
+ if {$permission($action) } {
+ dbg "requested action $action for user $user is granted" 4
return 1;
} else {
- dbg "requested action $action is not granted" 4
+ dbg "requested action $action for user $user is not granted" 1
return 0;
}
}
@@ -266,6 +272,7 @@ proc ChoseAction {action permission_list user} {
array set permission $permission_list
dbg "requested action: $action" 1
if { [isActionGranted $action $permission_list $user] } {
+
switch $action {
sort { SetSortColumn; ChoseAction defaultview $permission_list $user }
addcolumn {