/**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;}
p->setEnabled(req->hasRole("gethostkey"));
vl->addStretch(10);
- if(req->hasRole("gethosts")){
+ if(req->hasRight(req->RGetAllHosts)){
updateHosts();
}else{
setEnabled(false);
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()
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);
}
}
<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>