extend transaction class to use DB transactions as well, changed authentication slightly
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sun, 4 Apr 2010 13:00:02 +0000 (13:00 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sun, 4 Apr 2010 13:00:02 +0000 (13:00 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@433 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

wob/magicsmoke.wolf
www/inc/wext/autoload.php
www/inc/wext/transaction.php [new file with mode: 0644]

index ae08b0e..21f18eb 100644 (file)
        
        <!-- configure output -->
        <QtClientOutput sourceDir="src" subDir="wob" priInclude="wob.pri" classPrefix="M" clean="yes"/>
-       <PHPServerOutput sourceDir="www" subDir="inc/wob" extension=".php" clean="yes">
-               <Authenticator 
-                       isAuthenticated="Session::instance()->isAuthenticated()"
-                       hasRole="Session::instance()->canExecute(%)"
-                       userName="Session::currentUserName()"
-                       init="new Session($this)"/>
+       <PHPServerOutput sourceDir="www" subDir="inc/wob" extension=".php" clean="yes" transactionBase="MSmokeTransaction">
        </PHPServerOutput>
        <HtmlOutput sourceDir="doc" subDir="wob" clean="yes"/>
        
index 1dbec32..3c7d937 100644 (file)
@@ -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 (file)
index 0000000..7770904
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+// +----------------------------------------------------------------------
+// | PHP Source                                                           
+// +----------------------------------------------------------------------
+// | Copyright (C) 2010 by Konrad Rosenbaum <konrad@silmor.de>
+// +----------------------------------------------------------------------
+// |
+// | 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();
+       }
+};
+
+?>