Add strict mode Only the root user can open the editing interface(在三权分立模式下只有root用户能打开网络编辑界面)

This commit is contained in:
liushanwen 2021-01-22 16:44:43 +08:00
parent 5ed582bc87
commit 477bb6fc57
3 changed files with 26 additions and 6 deletions

View File

@ -18,7 +18,7 @@ CONFIG += release
# CONFIG += link_pkgconfig
# PKGCONFIG += gsettings-qt
LIBS += -L/usr/lib/ -lgsettings-qt -lX11
LIBS += -L/usr/lib/ -lgsettings-qt -lX11 -lkysec
target.path = /usr/bin
target.source += $$TARGET
@ -35,6 +35,10 @@ INSTALLS += target \
inst1 \
inst2 \
TRANSLATIONS += ./translations/kylin-nm_zh_CN.ts \
./translations/kylin-nm_tr.ts \
./translations/kylin-nm_bo.ts
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
@ -138,9 +142,7 @@ unix {
OBJECTS_DIR = .obj
}
TRANSLATIONS = translations/kylin-nm_zh_CN.ts \
translations/kylin-nm_tr.ts \
translations/kylin-nm_bo.ts
DISTFILES += \
src/conf/com.kylin.NetworkManager.qt.systemdbus.conf \

View File

@ -2098,8 +2098,23 @@ QString MainWindow::getMacByUuid(QString uuidName)
void MainWindow::on_btnAdvConf_clicked()
{
QProcess *qprocess = new QProcess(this);
qprocess->start("nm-connection-editor &");
if (!kysec_is_disabled() && kysec_get_3adm_status()) {
//三权分立启用的操作
qDebug() << "三权分立启用的操作------>";
QMessageBox msgBox;
msgBox.setWindowTitle(QObject::tr("kylin-nm"));
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText(QObject::tr("Insufficient permissions"));
msgBox.addButton(QMessageBox::Ok);
msgBox.button(QMessageBox::Ok)->setText(QObject::tr("OK"));
msgBox.exec();
} else {
//三权分立未启用的操作
qDebug() << "三权分立未启用的操作";
QProcess *qprocess = new QProcess(this);
qprocess->start("nm-connection-editor &");
}
return;
}
void MainWindow::on_btnFlyMode_clicked()

View File

@ -63,6 +63,9 @@
#include <QStringList>
#include <QToolTip>
#include <QSvgRenderer>
#include <kysec/libkysec.h>
#include <kysec/status.h>
#include <QMessageBox>
#define W_LEFT_AREA 41
#define W_VERTICAL_LINE 1 //左边竖线宽度