summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-03-23 01:08:28 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-03-23 01:08:28 -0500
commitd969e63d2c0d827a33f68c4f5c0ec1634c390fd0 (patch)
tree5ae59c16042a6bb822f653244305cfe52a1a2baa /src
parent9e37d8b745632d3da494c68f66f31d8e304c6e41 (diff)
downloadkcmldapmanager-d969e63d2c0d827a33f68c4f5c0ec1634c390fd0.tar.gz
kcmldapmanager-d969e63d2c0d827a33f68c4f5c0ec1634c390fd0.zip
Add machine add dialog
Add user list command to cmdline utility Fix user add command in cmdline utility
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/groupconfigdlg.cpp2
-rw-r--r--src/ldapconfigbase.ui10
-rw-r--r--src/ldapmgr.cpp25
-rw-r--r--src/ldapmgr.h1
-rw-r--r--src/machineconfigbase.ui195
-rw-r--r--src/machineconfigdlg.cpp99
-rw-r--r--src/machineconfigdlg.h50
-rw-r--r--src/userconfigdlg.cpp2
9 files changed, 377 insertions, 9 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 6f0e15e..3dd58bb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,7 @@ METASOURCES = AUTO
# Install this plugin in the KDE modules directory
kde_module_LTLIBRARIES = kcm_ldapmanager.la
-kcm_ldapmanager_la_SOURCES = ldapmgr.cpp ldapconfigbase.ui userconfigbase.ui groupconfigbase.ui serviceconfigbase.ui userconfigdlg.cpp groupconfigdlg.cpp serviceconfigdlg.cpp
+kcm_ldapmanager_la_SOURCES = ldapmgr.cpp ldapconfigbase.ui userconfigbase.ui groupconfigbase.ui machineconfigbase.ui serviceconfigbase.ui userconfigdlg.cpp groupconfigdlg.cpp machineconfigdlg.cpp serviceconfigdlg.cpp
kcm_ldapmanager_la_LIBADD = -ltdeio $(LIB_TDEUI) -lldap -ltdeldap
kcm_ldapmanager_la_LDFLAGS = -avoid-version -module -no-undefined \
$(all_libraries)
diff --git a/src/groupconfigdlg.cpp b/src/groupconfigdlg.cpp
index 38e2850..6898e2a 100644
--- a/src/groupconfigdlg.cpp
+++ b/src/groupconfigdlg.cpp
@@ -50,7 +50,7 @@ GroupConfigDialog::GroupConfigDialog(LDAPGroupInfo group, LDAPConfig* parent, co
m_base->groupName->setEnabled(false);
}
- m_base->detailsIcon->setPixmap(SmallIcon("kdmconfig.png"));
+ m_base->detailsIcon->setPixmap(SmallIcon("tdmconfig.png"));
connect(m_base->addToGroup, TQT_SIGNAL(clicked()), this, TQT_SLOT(addSelectedUserToGroup()));
connect(m_base->removeFromGroup, TQT_SIGNAL(clicked()), this, TQT_SLOT(removeSelectedUserFromGroup()));
diff --git a/src/ldapconfigbase.ui b/src/ldapconfigbase.ui
index 0214857..d6ff638 100644
--- a/src/ldapconfigbase.ui
+++ b/src/ldapconfigbase.ui
@@ -429,13 +429,21 @@
<string>Refresh</string>
</property>
</widget>
- <widget class="TQGroupBox" row="1" column="0" colspan="3">
+ <widget class="TQGroupBox" row="1" column="0" colspan="4">
<property name="name">
<cstring>groupGroupDetails</cstring>
</property>
<property name="title">
<string>Group Members</string>
</property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
diff --git a/src/ldapmgr.cpp b/src/ldapmgr.cpp
index 5da7169..3d7e581 100644
--- a/src/ldapmgr.cpp
+++ b/src/ldapmgr.cpp
@@ -48,6 +48,7 @@
#include "ldappasswddlg.h"
#include "userconfigdlg.h"
#include "groupconfigdlg.h"
+#include "machineconfigdlg.h"
#include "serviceconfigdlg.h"
// FIXME
@@ -91,7 +92,7 @@ LDAPConfig::LDAPConfig(TQWidget *parent, const char *name, const TQStringList&)
base->service_author->setEnabled(false);
base->user_icon->setPixmap(SmallIcon("personal.png"));
- base->group_icon->setPixmap(SmallIcon("kdmconfig.png"));
+ base->group_icon->setPixmap(SmallIcon("tdmconfig.png"));
base->machine_icon->setPixmap(SmallIcon("system.png"));
base->service_icon->setPixmap(SmallIcon("kcmsystem.png"));
@@ -108,6 +109,7 @@ LDAPConfig::LDAPConfig(TQWidget *parent, const char *name, const TQStringList&)
connect(base->user_buttonAdd, TQT_SIGNAL(clicked()), this, TQT_SLOT(addNewUser()));
connect(base->group_buttonAdd, TQT_SIGNAL(clicked()), this, TQT_SLOT(addNewGroup()));
+ connect(base->machine_buttonAdd, TQT_SIGNAL(clicked()), this, TQT_SLOT(addNewMachine()));
connect(base->service_buttonAdd, TQT_SIGNAL(clicked()), this, TQT_SLOT(addNewService()));
connect(base->user_buttonModify, TQT_SIGNAL(clicked()), this, TQT_SLOT(modifySelectedUser()));
connect(base->group_buttonModify, TQT_SIGNAL(clicked()), this, TQT_SLOT(modifySelectedGroup()));
@@ -235,11 +237,9 @@ void LDAPConfig::processLockouts() {
else {
base->machine_buttonDelete->setEnabled(false);
}
+ base->machine_buttonAdd->setEnabled(connected);
// FIXME
- // Disable machine add/modify as they are not implemented
- // In fact, I don't know if I CAN implement them!
- // Think about it...yes you can add the 'add' feature...kadmin 'ank --random-key host/HOSTNAME.FQDN'...
- base->machine_buttonAdd->setEnabled(false);
+ // Disable machine modify as it is not yet implemented
base->machine_buttonModify->setEnabled(false);
base->machine_buttonRefresh->setEnabled(connected);
@@ -777,6 +777,21 @@ void LDAPConfig::addNewGroup() {
updateAllInformation();
}
+void LDAPConfig::addNewMachine() {
+ // Launch a dialog to add the machine
+ LDAPMachineInfo machine;
+
+ MachineConfigDialog machineconfigdlg(machine, m_ldapmanager->realm(), this);
+ if (machineconfigdlg.exec() == TQDialog::Accepted) {
+ machine = machineconfigdlg.m_machine;
+ TQString errorstring;
+ if (m_ldapmanager->addMachineInfo(machine, &errorstring) != 0) {
+ KMessageBox::error(0, i18n("<qt>Unable to add new machine!<p>%1</qt>").arg(errorstring), i18n("Internal Failure"));
+ }
+ }
+ updateAllInformation();
+}
+
void LDAPConfig::addNewService() {
// Launch a dialog to add the service
LDAPServiceInfo service;
diff --git a/src/ldapmgr.h b/src/ldapmgr.h
index bb3e407..48fe954 100644
--- a/src/ldapmgr.h
+++ b/src/ldapmgr.h
@@ -67,6 +67,7 @@ class LDAPConfig: public TDECModule
void serviceHighlighted();
void addNewUser();
void addNewGroup();
+ void addNewMachine();
void addNewService();
void modifySelectedUser();
void modifySelectedGroup();
diff --git a/src/machineconfigbase.ui b/src/machineconfigbase.ui
new file mode 100644
index 0000000..bc05add
--- /dev/null
+++ b/src/machineconfigbase.ui
@@ -0,0 +1,195 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+ <class>LDAPMachineConfigBase</class>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>LDAPMachineConfigBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>519</width>
+ <height>356</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>TabWidget2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>detailsTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Kerberos Machine</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLayoutWidget" row="1" column="0" colspan="3">
+ <property name="name">
+ <cstring>unnamed_layoutwidget</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0" colspan="1">
+ <property name="name">
+ <cstring>detailsIcon</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="1" colspan="1">
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="text">
+ <string>Machine Name</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="2" colspan="1">
+ <property name="name">
+ <cstring>machineName</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="3" colspan="1">
+ <property name="name">
+ <cstring>realmNameLabel</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="TQLayoutWidget" row="2" column="0" colspan="3">
+ <property name="name">
+ <cstring>unnamed_layoutwidget</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQButtonGroup" row="2" column="0" colspan="4">
+ <property name="name">
+ <cstring>validBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <property name="radioButtonExclusive">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQRadioButton" row="0" column="0" colspan="1">
+ <property name="name">
+ <cstring>autoGeneratePassword</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="1" colspan="2">
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="text">
+ <cstring>Generate new random password</cstring>
+ </property>
+ </widget>
+ <widget class="TQRadioButton" row="1" column="0" colspan="1">
+ <property name="name">
+ <cstring>manuallySpecifyPassword</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="1" colspan="1">
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="text">
+ <cstring>Set specified password</cstring>
+ </property>
+ </widget>
+ <widget class="KPasswordEdit" row="1" column="2" colspan="1">
+ <property name="name">
+ <cstring>specifiedPassword</cstring>
+ </property>
+ <property name="enabled">
+ <cstring>true</cstring>
+ </property>
+ </widget>
+ <spacer row="1" column="2">
+ <property name="name" stdset="0">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+ </widget>
+ <includes>
+ <include location="local" impldecl="in implementation">LDAPMachineConfigBase.ui.h</include>
+ </includes>
+ <includes>
+ <include location="local" impldecl="in implementation">kdialog.h</include>
+ <include location="local" impldecl="in declaration">kpassdlg.h</include>
+ </includes>
+ <layoutdefaults spacing="3" margin="6"/>
+ <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI> \ No newline at end of file
diff --git a/src/machineconfigdlg.cpp b/src/machineconfigdlg.cpp
new file mode 100644
index 0000000..37954be
--- /dev/null
+++ b/src/machineconfigdlg.cpp
@@ -0,0 +1,99 @@
+/***************************************************************************
+ * Copyright (C) 2013 by Timothy Pearson *
+ * kb9vqf@pearsoncomputing.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include <tdelocale.h>
+#include <klineedit.h>
+#include <ktextedit.h>
+#include <knuminput.h>
+#include <tdeactionselector.h>
+#include <tqlistbox.h>
+#include <kpushbutton.h>
+#include <tqpixmap.h>
+#include <tqiconset.h>
+#include <tqlabel.h>
+#include <kurlrequester.h>
+#include <kcombobox.h>
+#include <tqradiobutton.h>
+#include <tqcheckbox.h>
+#include <kdatetimewidget.h>
+#include <kiconloader.h>
+
+#include "ldapmgr.h"
+#include "machineconfigdlg.h"
+
+MachineConfigDialog::MachineConfigDialog(LDAPMachineInfo machine, TQString realmName, LDAPConfig* parent, const char* name)
+ : KDialogBase(parent, name, true, i18n("LDAP Machine Properties"), Ok|Cancel, Ok, true), m_machine(machine), m_ldapconfig(parent)
+{
+ m_base = new LDAPMachineConfigBase(this);
+ setMainWidget(m_base);
+
+ m_base->detailsIcon->setPixmap(SmallIcon("system.png"));
+
+ m_base->realmNameLabel->setText("."+realmName.lower());
+
+ connect(m_base->machineName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(processLockouts()));
+ connect(m_base->specifiedPassword, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(processLockouts()));
+ connect(m_base->autoGeneratePassword, TQT_SIGNAL(clicked()), this, TQT_SLOT(processLockouts()));
+ connect(m_base->manuallySpecifyPassword, TQT_SIGNAL(clicked()), this, TQT_SLOT(manuallySpecifyPasswordClicked()));
+
+ m_base->autoGeneratePassword->setChecked(true);
+ m_base->manuallySpecifyPassword->setChecked(false);
+
+ m_base->machineName->setFocus();
+
+ processLockouts();
+}
+
+void MachineConfigDialog::slotOk() {
+ m_machine.name = m_base->machineName->text();
+ if (m_base->autoGeneratePassword->isOn() == true) {
+ m_machine.newPassword = TQString();
+ }
+ else if (m_base->manuallySpecifyPassword->isOn() == true) {
+ m_machine.newPassword = m_base->specifiedPassword->password();
+ }
+
+ accept();
+}
+
+void MachineConfigDialog::processLockouts() {
+ m_base->specifiedPassword->setEnabled(m_base->manuallySpecifyPassword->isOn());
+
+ if (((m_base->manuallySpecifyPassword->isOn() == true) && (strcmp(m_base->specifiedPassword->password(), "") == 0)) || (m_base->machineName->text() == "")) {
+ enableButton(KDialogBase::Ok, false);
+ }
+ else {
+ enableButton(KDialogBase::Ok, true);
+ }
+}
+
+void MachineConfigDialog::manuallySpecifyPasswordClicked() {
+ processLockouts();
+
+ if (m_base->specifiedPassword->isEnabled()) {
+ m_base->specifiedPassword->setFocus();
+ }
+}
+
+LDAPMachineInfo MachineConfigDialog::machineProperties() {
+ return m_machine;
+}
+
+#include "machineconfigdlg.moc"
diff --git a/src/machineconfigdlg.h b/src/machineconfigdlg.h
new file mode 100644
index 0000000..25f2554
--- /dev/null
+++ b/src/machineconfigdlg.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (C) 2013 by Timothy Pearson *
+ * kb9vqf@pearsoncomputing.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef _MACHINECONFIGDIALOG_H_
+#define _MACHINECONFIGDIALOG_H_
+
+#include <kdialogbase.h>
+
+#include "libtdeldap.h"
+#include "machineconfigbase.h"
+
+class MachineConfigDialog : public KDialogBase
+{
+ Q_OBJECT
+
+public:
+ MachineConfigDialog(LDAPMachineInfo machine, TQString realmName, LDAPConfig* parent = 0, const char* name = 0);
+ LDAPMachineInfo machineProperties();
+
+public slots:
+ void slotOk();
+ void processLockouts();
+ void manuallySpecifyPasswordClicked();
+
+public:
+ LDAPMachineConfigBase *m_base;
+ LDAPMachineInfo m_machine;
+
+private:
+ LDAPConfig* m_ldapconfig;
+};
+
+#endif // _MACHINECONFIGDIALOG_H_
diff --git a/src/userconfigdlg.cpp b/src/userconfigdlg.cpp
index 0eabcaa..8f23ed5 100644
--- a/src/userconfigdlg.cpp
+++ b/src/userconfigdlg.cpp
@@ -58,7 +58,7 @@ UserConfigDialog::UserConfigDialog(LDAPUserInfo user, LDAPConfig* parent, const
m_base->enabledIcon->setPixmap(SmallIcon("decrypted.png"));
m_base->disabledIcon->setPixmap(SmallIcon("encrypted.png"));
m_base->userIcon->setPixmap(SmallIcon("personal.png"));
- m_base->groupsIcon->setPixmap(SmallIcon("kdmconfig.png"));
+ m_base->groupsIcon->setPixmap(SmallIcon("tdmconfig.png"));
m_base->passwordIcon->setPixmap(SmallIcon("password.png"));
connect(m_base->loginName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(processLockouts()));