From: konrad Date: Sun, 4 Apr 2010 13:00:02 +0000 (+0000) Subject: extend transaction class to use DB transactions as well, changed authentication slightly X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=1160fd2b496225df0a4ceb42b3e84ef48c31059a;p=konrad%2Fsmoke.git extend transaction class to use DB transactions as well, changed authentication slightly git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@433 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/wob/magicsmoke.wolf b/wob/magicsmoke.wolf index ae08b0e..21f18eb 100644 --- a/wob/magicsmoke.wolf +++ b/wob/magicsmoke.wolf @@ -28,12 +28,7 @@ - - + diff --git a/www/inc/wext/autoload.php b/www/inc/wext/autoload.php index 1dbec32..3c7d937 100644 --- a/www/inc/wext/autoload.php +++ b/www/inc/wext/autoload.php @@ -23,4 +23,6 @@ $AUTOCLASS["WORole"]="inc/wext/role.php"; $AUTOCLASS["WORoom"]="inc/wext/room.php"; $AUTOCLASS["WOTemplate"]="inc/wext/template.php"; $AUTOCLASS["WOTicket"]="inc/wext/ticket.php"; + +$AUTOCLASS["MSmokeTransaction"]="inc/wext/transaction.php"; ?> \ No newline at end of file diff --git a/www/inc/wext/transaction.php b/www/inc/wext/transaction.php new file mode 100644 index 0000000..7770904 --- /dev/null +++ b/www/inc/wext/transaction.php @@ -0,0 +1,52 @@ + +// +---------------------------------------------------------------------- +// | +// | Copyright: See COPYING file that comes with this distribution +// +---------------------------------------------------------------------- +// + +class MSmokeTransaction extends WobTransaction +{ + public function __construct() + { + //make sure we have a session + new Session($this); + } + + protected function startTransaction() + { + global $db; + $db->beginTransaction(); + } + protected function commitTransaction() + { + global $db; + $db->commitTransaction(); + } + protected function abortTransaction() + { + global $db; + $db->rollbackTransaction(); + } + + protected function isAuthenticated() + { + return Session::instance()->isAuthenticated(); + } + + protected function isAuthorized($tn) + { + return Session::instance()->isAuthenticated() && Session::instance()->canExecute($tn); + } + + protected function userName() + { + return Session::currentUserName(); + } +}; + +?>