From af5300d4fd566cf78fba88ff948f7726e92b0f8b Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Fri, 21 Jan 2011 12:26:52 -0500 Subject: using AddAccessRightNonWeb for table creation of AccessRights table Ignore-this: 1ade5426dcf3d4439b303379806b1914 darcs-hash:20110121172652-067c0-25033fd63c368df70756db00a7ec89c8a9df3f37.gz --- GradeBook.tcl | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'GradeBook.tcl') diff --git a/GradeBook.tcl b/GradeBook.tcl index 622704a..90207a7 100755 --- a/GradeBook.tcl +++ b/GradeBook.tcl @@ -90,23 +90,29 @@ proc AddAccessRightNonWeb { action instructor_right ta_right student_right guest } proc CreateAccessRightsTable {db} { - db eval {CREATE TABLE AccessRightsTable(actionname text, instructor integer, ta integer, student integer, guest integer)} - # guest should have no rights make sure that 0 is evereywhere - db eval {INSERT INTO AccessRightsTable VALUES('logon', 1, 1, 1, 1)} - db eval {INSERT INTO AccessRightsTable VALUES('showgrades', 1, 1, 1, 0)} - db eval {INSERT INTO AccessRightsTable VALUES('sort', 1, 1, 0, 0)} - db eval {INSERT INTO AccessRightsTable VALUES('addcolumnrequest', 1, 1, 0, 0)} - db eval {INSERT INTO AccessRightsTable VALUES('addcolumn', 1, 1, 0, 0)} - db eval {INSERT INTO AccessRightsTable VALUES('deletecolumn', 1, 1, 0, 0)} - db eval {INSERT INTO AccessRightsTable VALUES('showcontrols', 1, 1, 1, 0)} - db eval {INSERT INTO AccessRightsTable VALUES('changegrades', 1, 1, 0, 0)} - db eval {INSERT INTO AccessRightsTable VALUES('updategrades', 1, 1, 0, 0)} - db eval {INSERT INTO AccessRightsTable VALUES('changecolumn', 1, 1, 0, 0)} - db eval {INSERT INTO AccessRightsTable VALUES('updatecolumn', 1, 1, 0, 0)} - db eval {INSERT INTO AccessRightsTable VALUES('logoff', 1, 1, 1, 0)} - db eval {INSERT INTO AccessRightsTable VALUES('changefirstname', 1, 0, 0, 0)} - db eval {INSERT INTO AccessRightsTable VALUES('changelastname', 1, 0, 0, 0)} - db eval {INSERT INTO AccessRightsTable VALUES('changeusername', 1, 0, 0, 0)} + set err [catch {db eval {CREATE TABLE AccessRightsTable(actionname text, instructor integer, ta integer, student integer, guest integer)} } errStat] + if { $err } { + htmlErrorMsg $errStat + dbg "the following error happen: $errStat" 1 + } + # guest should have no rights make sure that 0 is evereywhere except logon + # actionname instructor ta student guest + AddAccessRightNonWeb logon 1 1 1 1 + AddAccessRightNonWeb showgrades 1 1 1 0 + AddAccessRightNonWeb sort 1 1 0 0 + AddAccessRightNonWeb addcolumnrequest 1 1 0 0 + AddAccessRightNonWeb addcolumn 1 1 0 0 + AddAccessRightNonWeb deletecolumn 1 1 0 0 + AddAccessRightNonWeb showcontrols 1 1 1 0 + AddAccessRightNonWeb changegrades 1 1 0 0 + AddAccessRightNonWeb updategrades 1 1 0 0 + AddAccessRightNonWeb changecolumn 1 1 0 0 + AddAccessRightNonWeb updatecolumn 1 1 0 0 + AddAccessRightNonWeb logoff 1 1 1 0 + AddAccessRightNonWeb changefirstname 1 0 0 0 + AddAccessRightNonWeb changelastname 1 0 0 0 + AddAccessRightNonWeb changeusername 1 0 0 0 + AddAccessRightNonWeb hidecolumn 1 1 1 0 } proc htmlErrorMsg { msg } { -- cgit v1.2.3