void FLAccessControlLists::installACL(const QString &idacl) { QDomDocument doc("ACL"); QDomElement root = doc.createElement("ACL"); doc.appendChild(root); QDomElement name = doc.createElement("name"); root.appendChild(name); QDomText n = doc.createTextNode(idacl); name.appendChild(n); FLSqlQuery q; q.setTablesList("flacs"); q.setSelect("idac,tipo,nombre,iduser,idgroup,degrupo,permiso"); q.setFrom("flacs"); q.setWhere(QString::fromLatin1("idacl='") + idacl + QString::fromLatin1("'")); q.setOrderBy("prioridad DESC,tipo"); q.setForwardOnly(true); if (q.exec()) { uint step = 0; QProgressDialog progress(QApplication::tr("Instalando control de acceso..."), 0, q.size(), 0, 0, true); progress.setCaption(QApplication::tr("Instalando ACL")); progress.setMinimumDuration(0); progress.setProgress(++step); while (q.next()) { makeRule(&q, &doc); progress.setProgress(++step); } FLSqlConnections::database()->managerModules()->setContent("acl.xml", "sys", doc.toString()); } }
FLSqlQuery *FLManager::query(const QString &n, QObject *parent) { FLSqlQuery *q; QDomDocument doc(n); if (!FLUtil::domDocumentSetContent( doc, db_->managerModules()->contentCached(n + QString::fromLatin1(".qry")) )) { #ifdef FL_DEBUG qWarning("FLManager : " + QApplication::tr("Error al cargar la consulta %1").arg(n)); #endif return 0; } q = new FLSqlQuery(parent, db_->connectionName()); QDomElement docElem = doc.documentElement(); QDomNode no = docElem.firstChild(); while (!no.isNull()) { QDomElement e = no.toElement(); if (!e.isNull()) { if (e.tagName() == "name") { q->setName(e.text()); no = no.nextSibling(); continue; } if (e.tagName() == "tables") { q->setTablesList(e.text()); no = no.nextSibling(); continue; } if (e.tagName() == "select") { q->setSelect(e.text()); no = no.nextSibling(); continue; } if (e.tagName() == "from") { q->setFrom(e.text()); no = no.nextSibling(); continue; } if (e.tagName() == "where") { q->setWhere(e.text()); no = no.nextSibling(); continue; } if (e.tagName() == "param") { q->addParameter(queryParameter(&e)); no = no.nextSibling(); continue; } if (e.tagName() == "group") { q->addGroup(queryGroup(&e)); no = no.nextSibling(); continue; } if (e.tagName() == "order") { q->setOrderBy(e.text()); no = no.nextSibling(); continue; } } no = no.nextSibling(); } return q; }