[PC-BSD Commits] r143 - pcbsd/trunk/pcbsdusermanager

svn at pcbsd.org svn at pcbsd.org
Sat Mar 17 01:32:20 PST 2007


Author: tim
Date: 2007-03-17 10:32:19 +0100 (Sat, 17 Mar 2007)
New Revision: 143

Modified:
   pcbsd/trunk/pcbsdusermanager/maindlgcode.cpp
   pcbsd/trunk/pcbsdusermanager/maindlgcode.h
Log:
Disabled certain form options for the root user, and the wheel group to avoid accidental removal, and misconfiguration.

Modified: pcbsd/trunk/pcbsdusermanager/maindlgcode.cpp
===================================================================
--- pcbsd/trunk/pcbsdusermanager/maindlgcode.cpp	2007-03-15 21:58:26 UTC (rev 142)
+++ pcbsd/trunk/pcbsdusermanager/maindlgcode.cpp	2007-03-17 09:32:19 UTC (rev 143)
@@ -116,6 +116,14 @@
     getGroupDetails(groupList->currentText());
 }
 
+void mainDlgCode::enableEdits(bool enable)
+{
+    deleteButton->setEnabled(enable);
+    fullnameBox->setEnabled(enable);
+    homeBox->setEnabled(enable);
+    groupBox->setEnabled(enable);
+}
+
 void mainDlgCode::getUserDetails(const QString &username)
 {
     systemChange = true;
@@ -123,6 +131,8 @@
     qDebug("Fetching details for user: %s", username.ascii());
     User *user = back->getUser(username);
     
+    //Disable certain form fields if the user is root, to stop changing of important fields
+    enableEdits(username != "root");
     QString uid = QString::number(user->getUid());
     if (uid == "-1") { uid = tr("New User"); }
     uidBox->setText(uid);
@@ -145,6 +155,9 @@
     QStringList users = back->getAllUsers(-1, -1);
     users.sort();
     Group *group = back->getGroup(groupname);
+
+    //Disable remove button if we're wheel
+    removeGroupBut->setEnabled(groupname != "wheel");
     memberPointer = memberList->currentItem();
     availablePointer = availableList->currentItem();
     memberList->clear();

Modified: pcbsd/trunk/pcbsdusermanager/maindlgcode.h
===================================================================
--- pcbsd/trunk/pcbsdusermanager/maindlgcode.h	2007-03-15 21:58:26 UTC (rev 142)
+++ pcbsd/trunk/pcbsdusermanager/maindlgcode.h	2007-03-17 09:32:19 UTC (rev 143)
@@ -73,6 +73,8 @@
     QColor orange;
     bool systemChange;
     
+    void enableEdits(bool enable);
+    
 signals:
     void changed(bool changed);
     void simpleView();



More information about the Commits mailing list