reactivated very basic host tab (most handling is still missing)
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Mon, 28 Dec 2009 17:49:39 +0000 (17:49 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Mon, 28 Dec 2009 17:49:39 +0000 (17:49 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@365 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

src/iface/msinterface.h
src/mwin/acltabs.cpp
src/mwin/overview.cpp
wob/user.wolf

index f4532a2..fa99253 100644 (file)
@@ -33,6 +33,9 @@ class MSInterface:public MInterface
                /**returns the name of the current user*/
                QString currentUser()const{return m_uname;}
                
+               /**returns the name used for the host in this session*/
+               QString hostName()const{return m_host;}
+               
                /**returns whether the user is part of this role*/
                bool hasRole(QString)const{return false;}
                
index a6db96c..c0507e6 100644 (file)
@@ -253,7 +253,7 @@ MHostTab::MHostTab(QString pk)
        p->setEnabled(req->hasRole("gethostkey"));
        vl->addStretch(10);
        
-       if(req->hasRole("gethosts")){
+       if(req->hasRight(req->RGetAllHosts)){
                updateHosts();
        }else{
                setEnabled(false);
@@ -263,22 +263,23 @@ MHostTab::MHostTab(QString pk)
 
 
 void MHostTab::updateHosts()
-{/*TODO
+{
        bool foundThis=false;
        QString thisHost=req->hostName();
-       QList<MHost>hsl=req->getAllHosts();
+       MTGetAllHosts ah=req->queryGetAllHosts();
+       QList<MOHost>hsl=ah.gethosts();
        hostmodel->clear();
        hostmodel->insertColumns(0,2);
        hostmodel->insertRows(0,hsl.size());
        hostmodel->setHorizontalHeaderLabels(QStringList()<<tr("Host Name")<<tr("Host Key"));
        for(int i=0;i<hsl.size();i++){
-               hostmodel->setData(hostmodel->index(i,0),hsl[i].hostId());
-               hostmodel->setData(hostmodel->index(i,1),hsl[i].hostKey());
-               if(thisHost==hsl[i].hostId())
+               hostmodel->setData(hostmodel->index(i,0),hsl[i].name().value());
+               hostmodel->setData(hostmodel->index(i,1),hsl[i].key().value());
+               if(thisHost==hsl[i].name())
                        foundThis=true;
        }
        hosttable->resizeColumnsToContents();
-       thishostbutton->setEnabled(!foundThis && req->hasRole("addhost"));*/
+       thishostbutton->setEnabled(!foundThis && req->hasRight(req->RSetHost));
 }
 
 void MHostTab::newHost()
index a56190c..c5e0d26 100644 (file)
@@ -153,7 +153,7 @@ MOverview::MOverview(QString pk)
        if(!req->hasRight(req->RGetAllUsers)){
                tab->setTabEnabled(tab->indexOf(usertab),false);
        }
-       if(!req->hasRole("gethosts")){
+       if(!req->hasRight(req->RGetAllHosts)){
                tab->setTabEnabled(tab->indexOf(hosttab),false);
        }
 }
index 4026b7b..7303bf1 100644 (file)
                <Property name="name" type="string"/>
                <!-- if hostkey is NULL it is a special host (_any, _anon, _online) -->
                <Property name="key" type="string" />
+               <Mapping table="host">
+                       <Map column="hostname" property="name"/>
+                       <Map column="hostkey" property="key"/>
+               </Mapping>
        </Class>
        
        <Transaction name="GetAllUsers">
        
        <Transaction name="GetAllHosts">
                <Input/>
+               <Call lang="php" method="$this->sethosts(WOHost::fromTableArrayhost(WThost::selectFromDB()));"/>
                <Output>
                        <Var name="hosts" type="List:Host"/>
                </Output>