From c29b7c5cf905f516a9558a136a3cb71e7e25f1f9 Mon Sep 17 00:00:00 2001 From: konrad Date: Mon, 28 Dec 2009 17:36:56 +0000 Subject: [PATCH] re-activated user tab, role and host handling is still missing git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@364 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- src/dialogs/checkdlg.cpp | 55 ++++++++++++++++++++ src/dialogs/checkdlg.h | 61 ++++++++++++++++++++++ src/dialogs/dialogs.pri | 2 + src/iface/MORole.h | 19 +++++++ src/mwin/acltabs.cpp | 76 ++++++++++++++-------------- src/mwin/carttab.h | 1 + src/mwin/overview.cpp | 2 +- src/widgets/checkdlg.cpp | 104 -------------------------------------- src/widgets/checkdlg.h | 87 -------------------------------- src/widgets/widgets.pri | 2 - wob/user.wolf | 39 ++++++++++++++- woc/phpout.cpp | 3 + www/inc/loader.php | 1 + www/inc/machine/autoload.php | 1 + www/inc/machine/muser.php | 114 ++++++++++++++++++++++++++++++++++++++++++ www/inc/machine/session.php | 10 ---- www/inc/wbase/table.php | 7 ++- www/inc/wext/autoload.php | 15 ++++++ www/inc/wext/role.php | 27 ++++++++++ 19 files changed, 380 insertions(+), 246 deletions(-) create mode 100644 src/dialogs/checkdlg.cpp create mode 100644 src/dialogs/checkdlg.h create mode 100644 src/iface/MORole.h delete mode 100644 src/widgets/checkdlg.cpp delete mode 100644 src/widgets/checkdlg.h create mode 100644 www/inc/machine/muser.php create mode 100644 www/inc/wext/autoload.php create mode 100644 www/inc/wext/role.php diff --git a/src/dialogs/checkdlg.cpp b/src/dialogs/checkdlg.cpp new file mode 100644 index 0000000..79135ff --- /dev/null +++ b/src/dialogs/checkdlg.cpp @@ -0,0 +1,55 @@ +// +// C++ Implementation: checkdlg +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2008 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#include "checkdlg.h" + +#include +#include +#include +#include + +MCheckDialog::MCheckDialog(QWidget*parent,const MCheckList&checks,QString title) + :QDialog(parent),m_list(checks) +{ + setWindowTitle(title); + //basic layout + QVBoxLayout *vl=new QVBoxLayout; + setLayout(vl); + QScrollArea *sa=new QScrollArea; + vl->addWidget(sa,10); + QHBoxLayout *hl=new QHBoxLayout; + vl->addLayout(hl,0); + hl->addStretch(10); + QPushButton*p; + hl->addWidget(p=new QPushButton(tr("Ok")),0); + connect(p,SIGNAL(clicked()),this,SLOT(accept())); + hl->addWidget(p=new QPushButton(tr("Cancel")),0); + connect(p,SIGNAL(clicked()),this,SLOT(reject())); + //fill area + QWidget*w=new QWidget; + w->setLayout(vl=new QVBoxLayout); + for(int i=0;isetChecked(m_list[i].isSet()); + vl->addWidget(cb); + m_boxes.append(cb); + } + sa->setWidget(w); +} + +MCheckList MCheckDialog::getCheckList()const +{ + for(int i=0;iisChecked()); + return m_list; +} + diff --git a/src/dialogs/checkdlg.h b/src/dialogs/checkdlg.h new file mode 100644 index 0000000..a79a6cc --- /dev/null +++ b/src/dialogs/checkdlg.h @@ -0,0 +1,61 @@ +// +// C++ Interface: checkdlg +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2008 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#ifndef MAGICSMOKE_CHECKDLG_H +#define MAGICSMOKE_CHECKDLG_H + +#include +#include + +class QCheckBox; + +/**class for items that can be displayed in a MCheckDialog*/ +class MCheckItem +{ + public: + /**constructs a check item*/ + MCheckItem(QString key=QString(),bool isset=false,QString label=QString()) + {m_key=key;m_set=isset;if(label!="")m_label=label;else m_label=m_key;} + + /**overwrite this to return a label that can be displayed*/ + virtual QString label()const{return m_label;} + /**overwrite this to return a key string that identifies the item (default implementation returns the label)*/ + virtual QString key()const{return m_key;} + /**overwrite this to return whether the item is checked*/ + virtual bool isSet()const{return m_set;} + /**overwrite this to change the checking status of the item*/ + virtual void set(bool b){m_set=b;} + + protected: + QString m_key,m_label; + bool m_set; +}; + +/**implements a list of checkable items*/ +typedef QList MCheckList; + +/**a dialog that consists of check boxes in a QScrollArea */ +class MCheckDialog:public QDialog +{ + Q_OBJECT + public: + /**creates the dialog*/ + MCheckDialog(QWidget*parent,const MCheckList&checks,QString title); + + /**returns the current state of all check boxes, the return value is an exact copy of the check list from the constructor with updated check settings*/ + MCheckList getCheckList()const; + private: + QListm_boxes; + mutable MCheckList m_list; +}; + +#endif diff --git a/src/dialogs/dialogs.pri b/src/dialogs/dialogs.pri index c5377a2..0e72244 100644 --- a/src/dialogs/dialogs.pri +++ b/src/dialogs/dialogs.pri @@ -7,6 +7,7 @@ HEADERS += \ dialogs/login.h \ dialogs/shipping.h \ dialogs/customerdlg.h \ + dialogs/checkdlg.h \ dialogs/passwdchg.h SOURCES += \ @@ -18,6 +19,7 @@ SOURCES += \ dialogs/login.cpp \ dialogs/shipping.cpp \ dialogs/customerdlg.cpp \ + dialogs/checkdlg.cpp \ dialogs/passwdchg.cpp INCLUDEPATH += ./dialogs \ No newline at end of file diff --git a/src/iface/MORole.h b/src/iface/MORole.h new file mode 100644 index 0000000..ac961a5 --- /dev/null +++ b/src/iface/MORole.h @@ -0,0 +1,19 @@ +// +// C++ Interface: unabstract +// +// Description: removes abstract flag from classes that only need to be abstract in PHP +// +// +// Author: Konrad Rosenbaum , (C) 2009 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#ifndef MAGICSMOKE_MOROLE_H +#define MAGICSMOKE_MOROLE_H + +#include "MORoleAbstract.h" +typedef MORoleAbstract MORole; + +#endif \ No newline at end of file diff --git a/src/mwin/acltabs.cpp b/src/mwin/acltabs.cpp index 94233a8..a6db96c 100644 --- a/src/mwin/acltabs.cpp +++ b/src/mwin/acltabs.cpp @@ -11,36 +11,19 @@ // #include "checkdlg.h" -// #include "main.h" -// #include "misc.h" #include "msinterface.h" +#include "passwdchg.h" #include "acltabs.h" -// #include #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include #include #include #include -// #include -// #include #include #include -// #include -// #include #include -// #include -// #include #include -// #include #define req (MSInterface::instance()) @@ -59,27 +42,26 @@ MUserTab::MUserTab(QString pk) hl->addLayout(vl=new QVBoxLayout,0); vl->addWidget(p=new QPushButton(tr("New User...")),0); connect(p,SIGNAL(clicked()),this,SLOT(newUser())); - p->setEnabled(req->hasRole("adduser")); + p->setEnabled(req->hasRight(req->RCreateUser)); vl->addWidget(p=new QPushButton(tr("Delete User...")),0); connect(p,SIGNAL(clicked()),this,SLOT(deleteUser())); - p->setEnabled(req->hasRole("deleteuser")); + p->setEnabled(req->hasRight(req->RDeleteUser)); vl->addSpacing(20); vl->addWidget(p=new QPushButton(tr("Description...")),0); connect(p,SIGNAL(clicked()),this,SLOT(editUserDescription())); - p->setEnabled(req->hasRole("setuserdescription")); + p->setEnabled(req->hasRight(req->RSetUserDescription)); vl->addWidget(p=new QPushButton(tr("Hosts...")),0); connect(p,SIGNAL(clicked()),this,SLOT(editUserHosts())); - p->setEnabled(req->hasRole("getuserhosts")); + p->setEnabled(req->hasRight(req->RGetUserHosts)); vl->addWidget(p=new QPushButton(tr("Roles...")),0); connect(p,SIGNAL(clicked()),this,SLOT(editUserRoles())); - p->setEnabled(req->hasRole("getuseracl")); + p->setEnabled(req->hasRight(req->RGetUserRoles)); vl->addWidget(p=new QPushButton(tr("Set Password...")),0); connect(p,SIGNAL(clicked()),this,SLOT(setUserPassword())); - p->setEnabled(req->hasRole("setpasswd")); + p->setEnabled(req->hasRight(req->RChangePassword)); vl->addStretch(10); - //TODO: convert to right instead role - if(req->hasRole("getusers")){ + if(req->hasRight(req->RGetAllUsers)){ updateUsers(); }else{ setEnabled(false); @@ -143,7 +125,7 @@ void MUserTab::deleteUser() QString rp=QInputDialog::getItem(this,tr("Delete User"),tr("Select which user will inherit this users database objects:"),rplc,0,false,&ok); if(!ok)return; //delete - MTDeleteUser ret=req->queryDeleteUser(name,rp); + MTDeleteUser ret=req->queryDeleteUser(name,rp[0]=='('?"":rp); if(ret.hasError()) QMessageBox::warning(this,tr("Error"),tr("Cannot delete user: %1").arg(ret.errorString())); updateUsers(); @@ -159,7 +141,7 @@ void MUserTab::editUserDescription() QString descr=usermodel->data(usermodel->index(sel.row(),1)).toString(); //edit descr bool ok; - descr=QInputDialog::getText(this,tr("Edit Description"),tr("Descriptionof user %1:").arg(name),QLineEdit::Normal,descr,&ok); + descr=QInputDialog::getText(this,tr("Edit Description"),tr("Description of user %1:").arg(name),QLineEdit::Normal,descr,&ok); if(ok) req->querySetUserDescription(name,descr); //update @@ -167,18 +149,34 @@ void MUserTab::editUserDescription() } void MUserTab::editUserRoles() -{/*TODO +{ //get selection QModelIndex sel=usertable->currentIndex(); if(!sel.isValid())return; //get uname & descr QString name=usermodel->data(usermodel->index(sel.row(),0)).toString(); //... - MOUser usr(req,name); - MCheckList acl=usr.getRoles(); - MCheckDialog cd(this,acl,"Edit ACL of user "+name); - if(cd.exec()==QDialog::Accepted) - usr.setRoles(cd.getCheckList());*/ + MTGetUserRoles gr=req->queryGetUserRoles(name); + if(gr.hasError()){ + QMessageBox::warning(this,tr("Warning"),tr("Cannot retrieve user roles: %1").arg(gr.errorString())); + return; + } + MTGetAllRoles ar=req->queryGetAllRoles(); + if(ar.hasError()){ + QMessageBox::warning(this,tr("Warning"),tr("Cannot retrieve role descriptions: %1").arg(ar.errorString())); + return; + } + MCheckList acl; + QStringList urole=gr.getroles(); + QListaroles=ar.getroles(); + for(int i=0;icurrentIndex(); if(!sel.isValid())return; @@ -211,9 +209,11 @@ void MUserTab::setUserPassword() QMessageBox::warning(this,tr("Warning"),tr("The password must be non-empty and both lines must match")); return; } - //... - MUser usr(req,name); - usr.changePassword(p);*/ + //query + MTChangePassword cp=req->queryChangePassword(name,p); + if(cp.hasError()){ + QMessageBox::warning(this,tr("Warning"),tr("Error while setting password: %1").arg(cp.errorString())); + } } /*****************************************************************************/ diff --git a/src/mwin/carttab.h b/src/mwin/carttab.h index 976efb6..a0bb3a9 100644 --- a/src/mwin/carttab.h +++ b/src/mwin/carttab.h @@ -31,6 +31,7 @@ class QSpinBox; class QStandardItemModel; class QTabWidget; class QTableView; +class QTextEdit; class MSInterface; diff --git a/src/mwin/overview.cpp b/src/mwin/overview.cpp index b34f36c..a56190c 100644 --- a/src/mwin/overview.cpp +++ b/src/mwin/overview.cpp @@ -150,7 +150,7 @@ MOverview::MOverview(QString pk) if(!req->hasRole("getorderlist")){ tab->setTabEnabled(tab->indexOf(ordertab),false); } - if(!req->hasRole("getusers")){ + if(!req->hasRight(req->RGetAllUsers)){ tab->setTabEnabled(tab->indexOf(usertab),false); } if(!req->hasRole("gethosts")){ diff --git a/src/widgets/checkdlg.cpp b/src/widgets/checkdlg.cpp deleted file mode 100644 index 2d5a3f6..0000000 --- a/src/widgets/checkdlg.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// -// C++ Implementation: checkdlg -// -// Description: -// -// -// Author: Konrad Rosenbaum , (C) 2008 -// -// Copyright: See README/COPYING files that come with this distribution -// -// - -#include "checkdlg.h" - -#include -#include -#include -#include - -MCheckDialog::MCheckDialog(QWidget*parent,const MCheckList&checks,QString title) - :QDialog(parent),m_list(checks) -{ - setWindowTitle(title); - //basic layout - QVBoxLayout *vl=new QVBoxLayout; - setLayout(vl); - QScrollArea *sa=new QScrollArea; - vl->addWidget(sa,10); - QHBoxLayout *hl=new QHBoxLayout; - vl->addLayout(hl,0); - hl->addStretch(10); - QPushButton*p; - hl->addWidget(p=new QPushButton(tr("Ok")),0); - connect(p,SIGNAL(clicked()),this,SLOT(accept())); - hl->addWidget(p=new QPushButton(tr("Cancel")),0); - connect(p,SIGNAL(clicked()),this,SLOT(reject())); - //fill area - QWidget*w=new QWidget; - w->setLayout(vl=new QVBoxLayout); - for(int i=0;isetChecked(m_list[i].isSet()); - vl->addWidget(cb); - m_boxes.append(cb); - } - sa->setWidget(w); -} - -MCheckList MCheckDialog::getCheckList()const -{ - for(int i=0;iisChecked()); - return m_list; -} - -/**************************************************/ - -MCheckItem::MCheckItem(){} -MCheckItem::~MCheckItem(){} - -QString MCheckItem::key()const{qDebug("???????????");return label();} - -MCheckList::MCheckList(){} - -MCheckList::MCheckList(const MCheckList&l) -{ - for(int i=0;icopy()); -} - -MCheckList& MCheckList::operator=(const MCheckList&l) -{ - for(int i=0;icopy()); -} - -MCheckList::~MCheckList() -{ - for(int i=0;i, (C) 2008 -// -// Copyright: See README/COPYING files that come with this distribution -// -// - -#ifndef MAGICSMOKE_CHECKDLG_H -#define MAGICSMOKE_CHECKDLG_H - -#include -#include - -class QCheckBox; - -/**abstract base class for items that can be displayed in a MCheckDialog*/ -class MCheckItem -{ - public: - /**constructs an empty check item*/ - MCheckItem(); - /**deletes the check item*/ - virtual ~MCheckItem(); - - /**overwrite this to return a label that can be displayed*/ - virtual QString label()const=0; - /**overwrite this to return a key string that identifies the item (default implementation returns the label)*/ - virtual QString key()const; - /**overwrite this to return whether the item is checked*/ - virtual bool isSet()const=0; - /**overwrite this to change the checking status of the item*/ - virtual void set(bool)=0; - - protected: - friend class MCheckList; - /**overwrite this to creat an exact copy of the item (must be implemented and must return non-NULL)*/ - virtual MCheckItem* copy()const=0; -}; - -/**implements a list of checkable items*/ -class MCheckList -{ - public: - /**instantiate an empty list*/ - MCheckList(); - /**creates an exact copy of the list (uses MCheckItem::copy() )*/ - MCheckList(const MCheckList&); - /**deletes the list*/ - ~MCheckList(); - - /**adds an item to the list*/ - void addItem(MCheckItem*); - /**returns the size of the list*/ - int size()const; - - /**returns a writable reference to an item*/ - MCheckItem& operator[](int); - /**returns a const reference to an item*/ - const MCheckItem& operator[](int)const; - - /**makes this list an exact copy of the argument*/ - MCheckList& operator=(const MCheckList&); - private: - QList m_items; -}; - -/**a dialog that consists of check boxes in a QScrollArea */ -class MCheckDialog:public QDialog -{ - Q_OBJECT - public: - /**creates the dialog*/ - MCheckDialog(QWidget*parent,const MCheckList&checks,QString title); - - /**returns the current state of all check boxes, the return value is an exact copy of the check list from the constructor with updated check settings*/ - MCheckList getCheckList()const; - private: - QListm_boxes; - mutable MCheckList m_list; -}; - -#endif diff --git a/src/widgets/widgets.pri b/src/widgets/widgets.pri index 4ff2b0f..b6ff5eb 100644 --- a/src/widgets/widgets.pri +++ b/src/widgets/widgets.pri @@ -1,14 +1,12 @@ HEADERS += \ widgets/waitcursor.h \ widgets/centbox.h \ - widgets/checkdlg.h \ widgets/listview.h \ widgets/treeview.h SOURCES += \ widgets/waitcursor.cpp \ widgets/centbox.cpp \ - widgets/checkdlg.cpp \ widgets/listview.cpp \ widgets/treeview.cpp diff --git a/wob/user.wolf b/wob/user.wolf index 555f34d..4026b7b 100644 --- a/wob/user.wolf +++ b/wob/user.wolf @@ -120,8 +120,13 @@ + This class represents the main information about users: login name plus description. Passwords are never carried towards the client, more detailed info is contained in other classes. + + + + @@ -132,6 +137,7 @@ + @@ -143,6 +149,7 @@ + @@ -153,6 +160,7 @@ + @@ -161,6 +169,7 @@ + @@ -168,15 +177,16 @@ + + - @@ -185,9 +195,36 @@ + ; + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/woc/phpout.cpp b/woc/phpout.cpp index e1602c9..5f17b2a 100644 --- a/woc/phpout.cpp +++ b/woc/phpout.cpp @@ -146,6 +146,9 @@ void WocPHPServerOut::newTable(const WocTable&tbl) //initializer code+="protected function __construct(array $data,$isfromdb){parent::__construct($data,$isfromdb,\""+tbl.name()+"\");}\n\n"; + //static new instance for insert only + code+="public static function newRow(){return new WT"+tbl.name()+"(array(),false);}\n\n"; + //static get instance QStringList cols=tbl.columns(); QStringList pcols=tbl.primaryColumns(); diff --git a/www/inc/loader.php b/www/inc/loader.php index bc58c94..8ff61af 100644 --- a/www/inc/loader.php +++ b/www/inc/loader.php @@ -4,6 +4,7 @@ include_once("inc/tr.php"); //load WOB data include('./inc/wbase/autoload.php'); include('./inc/wob/autoload.php'); +include('./inc/wext/autoload.php'); //load DB drivers include('./inc/db/autoload.php'); include('./config.php'); diff --git a/www/inc/machine/autoload.php b/www/inc/machine/autoload.php index 441eb97..8461d74 100644 --- a/www/inc/machine/autoload.php +++ b/www/inc/machine/autoload.php @@ -16,4 +16,5 @@ $AUTOCLASS["Host"]="./inc/machine/host.php"; $AUTOCLASS["Template"]="./inc/machine/template.php"; $AUTOCLASS["Version"]="./inc/machine/version.php"; $AUTOCLASS["Translation"]="./inc/machine/translation.php"; +$AUTOCLASS["MachineUser"]="./inc/machine/muser.php"; ?> \ No newline at end of file diff --git a/www/inc/machine/muser.php b/www/inc/machine/muser.php new file mode 100644 index 0000000..7521705 --- /dev/null +++ b/www/inc/machine/muser.php @@ -0,0 +1,114 @@ +, (C) 2009 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +/**encapsulated machine user management in several static functions; +it is called directly from the user centered transactions; +DO NOT USE THIS CLASS OUTSIDE TRANSACTION CONTEXT!*/ +class MachineUser +{ + /**create a new user*/ + static public function createUser($trans) + { + //check whether user exists + $usr=WTuser::getFromDB($trans->getusername()); + if($usr!==false){ + $trans->abortWithError(tr("User already exists.")); + return; + } + //verify syntax + if(!ereg("^[a-zA-Z]([a-zA-Z_\\.-]*)$",$trans->getusername())){ + $trans->abortWithError(tr("Username is invalid.")); + return; + } + //create DB entry + $usr=WTuser::newRow(); + $usr->uname=$trans->getusername(); + $slt=getSalt(); + $hsh=sha1($slt.$trans->getpassword()); + $usr->passwd=$slt." ".$hsh; + $usr->insert(); + $trans->setuser(MOUser::fromTableuser($usr)); + } + + static public function deleteUser($trans) + { + //sanity check: do users exist + $un=$trans->getusername(); + $usr=WTuser::getFromDB($un); + if($usr===false){ + $trans->abortWithError(tr("User does not exist.")); + return; + } + $mun=$trans->getmergewithuser(); + if($mun=="")$mun=false; + $mu=false; + if($mun!==false){ + $mu=WTuser::getFromDB($mun); + if($mu===false){ + $trans->abortWithError(tr("Merge target user does not exist!")); + return; + } + } + //check: are users identical? + if($un==$mun){ + $trans->abortWithError(tr("User and merge target user are identical.")); + return; + } + //perform merge + global $db; + if($mu!==false){ + //TODO: merge users + } + //delete user + $usr->deleteFromDB(); + } + + static public function changePasswd($trans) + { + $usr=WTuser::getFromDB($trans->getusername()); + } + + static public function setUserDescription($trans) + { + $usr=WTuser::getFromDB($trans->getusername()); + if($usr===false){ + $trans->abortWithError(tr("User does not exist.")); + return; + } + $usr->description=$trans->getdescription(); + $usr->update(); + } + + static public function getUserRoles($trans) + { + //sanity check + $usr=WTuser::getFromDB($trans->getusername()); + if($usr===false){ + $trans->abortWithError(tr("User does not exist.")); + return; + } + //get roles + global $db; + $rls=WTuserrole::selectFromDB("uname=".$db->escapeString($trans->getusername())); + $r=array(); + foreach($rls as $rl){ + $r[]=$rl->role; + } + $trans->setroles($r); + } + + static public function setUserRoles($trans){} + +}; + +?> \ No newline at end of file diff --git a/www/inc/machine/session.php b/www/inc/machine/session.php index 357a301..fe9e70f 100644 --- a/www/inc/machine/session.php +++ b/www/inc/machine/session.php @@ -208,16 +208,6 @@ class Session if(in_array("_admin",$this->roles))return true; return in_array($transaction,$this->rights); } - - /**called for GetMyRoles transaction*/ - public function getMyRoles() - { - global $db; - header("X-MagicSmoke-Status: Ok"); - $res=$db->select("userrole","role","uname=".$db->escapeString($this->user)); - foreach($res as $rl) - print($rl["role"]."\n"); - } }; /**dummy class used by browsed pages to represent the virtual web user*/ diff --git a/www/inc/wbase/table.php b/www/inc/wbase/table.php index 7d103f2..a7e575a 100644 --- a/www/inc/wbase/table.php +++ b/www/inc/wbase/table.php @@ -135,7 +135,7 @@ abstract class WobTable /**insert the object under a new primary key value into the DB (implicitly calls newKey); returns true on success*/ public function insert() { - global $dbScheme; + global $dbScheme,$db; $this->isfromdb=false; //create new key $this->newKey(); @@ -148,7 +148,7 @@ abstract class WobTable $this->isfromdb=true; $this->data=$data; $this->cdata=array(); - createAudit(); + $this->createAudit(); //assign primary key if sequence (otherwise newKey has done it) $seq=$dbScheme->hasSequence($this->table); if($seq!==false) @@ -160,6 +160,7 @@ abstract class WobTable /**generate a new primary key value for insert and marks the object as not yet in the DB; the default sets the primary key to NULL if it is a sequence; call the original first if you overwrite it*/ public function newKey() { + global $dbScheme; $this->isfromdb=false; $pk=$dbScheme->hasSequence($this->table); if($pk!==false){ @@ -178,7 +179,7 @@ abstract class WobTable if($succ){ foreach($this->cdata as $k=>$d)$this->data[$k]=$d; $this->cdata=array(); - createAudit(); + $this->createAudit(); } return $succ; } diff --git a/www/inc/wext/autoload.php b/www/inc/wext/autoload.php new file mode 100644 index 0000000..bc716bf --- /dev/null +++ b/www/inc/wext/autoload.php @@ -0,0 +1,15 @@ +, (C) 2009 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +$AUTOCLASS["WORole"]="inc/wext/role.php"; +?> \ No newline at end of file diff --git a/www/inc/wext/role.php b/www/inc/wext/role.php new file mode 100644 index 0000000..4916d6a --- /dev/null +++ b/www/inc/wext/role.php @@ -0,0 +1,27 @@ +, (C) 2009 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +class WORole extends WORoleAbstract{ + protected function getRightsFromDB() + { + global $db; + $rtl=$db->select("roleright","rolename=".$db->escapeString($this->prop_name)); + $ret=array(); + foreach($rtl as $rt){ + $ret[]=$rt["rightname"]; + } + return $ret; + } +}; + +?> \ No newline at end of file -- 1.7.2.5