summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-05-18 16:42:15 -0500
committerTimothy Pearson <[email protected]>2012-05-18 16:42:15 -0500
commit9dfe67333622690d2b80714ed19adcf29d10b030 (patch)
tree025b70be9447606b31a055b5084e6245334cb6dc
parent37acc91cacd3f5c85e3254fcfd5794fcdcbadc27 (diff)
downloadkcmldap-9dfe67333622690d2b80714ed19adcf29d10b030.tar.gz
kcmldap-9dfe67333622690d2b80714ed19adcf29d10b030.zip
Add realm properties editor
-rw-r--r--src/Makefile.am2
-rw-r--r--src/bondrealmpage.cpp10
-rw-r--r--src/bondrealmpage.h2
-rw-r--r--src/ldap.cpp17
-rw-r--r--src/ldap.h1
-rw-r--r--src/realmpropertiesbase.ui60
-rw-r--r--src/realmpropertiesdialog.cpp60
-rw-r--r--src/realmpropertiesdialog.h11
8 files changed, 91 insertions, 72 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 7e6c5d2..2d17844 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_ldap.la
-kcm_ldap_la_SOURCES = ldap.cpp ldapconfigbase.ui realmpropertiesdialog.cpp realmpropertiesbase.ui bondintropage.cpp bondintropagedlg.ui bondrealmpage.cpp bondrealmpagedlg.ui bondfinishpage.cpp bondfinishpagedlg.ui bondwizard.cpp
+kcm_ldap_la_SOURCES = ldap.cpp ldapconfigbase.ui realmpropertiesdialog.cpp bondintropage.cpp bondintropagedlg.ui bondrealmpage.cpp bondrealmpagedlg.ui bondfinishpage.cpp bondfinishpagedlg.ui bondwizard.cpp
kcm_ldap_la_LIBADD = -lkio $(LIB_TDEUI)
kcm_ldap_la_LDFLAGS = -avoid-version -module -no-undefined \
$(all_libraries)
diff --git a/src/bondrealmpage.cpp b/src/bondrealmpage.cpp
index 020c5a5..80f047a 100644
--- a/src/bondrealmpage.cpp
+++ b/src/bondrealmpage.cpp
@@ -32,6 +32,7 @@
#include <kprocess.h>
#include <klineedit.h>
#include <kwizard.h>
+#include <kdialogbase.h>
#include "bondrealmpage.h"
@@ -44,6 +45,7 @@ BondRealmPage::BondRealmPage(TQWidget *parent, const char *name ) : BondRealmPag
connect(txtAdminServer, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
m_parentWizard = dynamic_cast<KWizard*>(parent);
+ m_parentDialog = dynamic_cast<KDialogBase*>(parent);
}
BondRealmPage::~BondRealmPage() {
@@ -59,6 +61,14 @@ void BondRealmPage::validateEntries() {
m_parentWizard->nextButton()->setEnabled(false);
}
}
+ if (m_parentDialog) {
+ if ((txtRealmName->text() != "") && (txtKDC->text() != "") && (txtAdminServer->text() != "")) {
+ m_parentDialog->enableButton(KDialogBase::Ok, true);
+ }
+ else {
+ m_parentDialog->enableButton(KDialogBase::Ok, false);
+ }
+ }
}
#include "bondrealmpage.moc"
diff --git a/src/bondrealmpage.h b/src/bondrealmpage.h
index 5117d7e..a73e166 100644
--- a/src/bondrealmpage.h
+++ b/src/bondrealmpage.h
@@ -27,6 +27,7 @@
class TQStringList;
class KWizard;
+class KDialogBase;
/**Abstract class for the first wizard page. Sets the according selection on save()
*@author Timothy Pearson
@@ -44,6 +45,7 @@ public slots:
private:
KWizard* m_parentWizard;
+ KDialogBase* m_parentDialog;
};
#endif
diff --git a/src/ldap.cpp b/src/ldap.cpp
index a3afbbf..2b230ba 100644
--- a/src/ldap.cpp
+++ b/src/ldap.cpp
@@ -37,6 +37,7 @@
#include "ldap.h"
#include "bondwizard.h"
+#include "realmpropertiesdialog.h"
// FIXME
// Connect this to CMake/Automake
@@ -65,6 +66,7 @@ LDAPConfig::LDAPConfig(TQWidget *parent, const char *name, const TQStringList&)
base = new LDAPConfigBase(this);
layout->add(base);
base->ldapRealmList->setAllColumnsShowFocus(true);
+ base->ldapRealmList->setFullWidth(true);
setRootOnlyMsg(i18n("<b>Bonded LDAP realms take effect system wide, and require administrator access to modify</b><br>To alter the system's bonded LDAP realms, click on the \"Administrator Mode\" button below."));
setUseRootOnlyMsg(true);
@@ -75,6 +77,7 @@ LDAPConfig::LDAPConfig(TQWidget *parent, const char *name, const TQStringList&)
connect(base->btnBondRealm, TQT_SIGNAL(clicked()), TQT_SLOT(bondToNewRealm()));
connect(base->btnRemoveRealm, TQT_SIGNAL(clicked()), TQT_SLOT(removeRealm()));
+ connect(base->btnRealmProperties, TQT_SIGNAL(clicked()), TQT_SLOT(realmProperties()));
load();
@@ -195,6 +198,9 @@ void LDAPConfig::save() {
systemconfig->sync();
+ // RAJA FIXME
+ // Write the appropriate /etc/krb5.conf file here!
+
load();
}
@@ -250,6 +256,17 @@ void LDAPConfig::removeRealm() {
}
}
+void LDAPConfig::realmProperties() {
+ TQListViewItem *selrealm = base->ldapRealmList->selectedItem();
+ if (selrealm) {
+ RealmPropertiesDialog rpdialog(&m_realms, selrealm->text(1), this);
+ if (rpdialog.exec() == TQDialog::Accepted) {
+ updateRealmList();
+ changed();
+ }
+ }
+}
+
int LDAPConfig::buttons() {
return KCModule::Apply|KCModule::Help;
}
diff --git a/src/ldap.h b/src/ldap.h
index 3494c12..93cdf10 100644
--- a/src/ldap.h
+++ b/src/ldap.h
@@ -78,6 +78,7 @@ class LDAPConfig: public KCModule
void processLockouts();
void bondToNewRealm();
void removeRealm();
+ void realmProperties();
private:
void updateRealmList();
diff --git a/src/realmpropertiesbase.ui b/src/realmpropertiesbase.ui
deleted file mode 100644
index 6e61a44..0000000
--- a/src/realmpropertiesbase.ui
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>RealmPropertiesBase</class>
-<widget class="TQWidget">
- <property name="name">
- <cstring>RealmPropertiesBase</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>664</width>
- <height>503</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>3</hsizetype>
- <vsizetype>3</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>640</width>
- <height>480</height>
- </size>
- </property>
- <property name="caption">
- <string>LDAP Realm Properties</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQGroupBox" row="0" column="0">
- <property name="name">
- <cstring>groupBox1</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>7</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string>Basic Settings</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- </grid>
- </widget>
- </grid>
-</widget>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
diff --git a/src/realmpropertiesdialog.cpp b/src/realmpropertiesdialog.cpp
index 2ae9428..eaf09e2 100644
--- a/src/realmpropertiesdialog.cpp
+++ b/src/realmpropertiesdialog.cpp
@@ -20,23 +20,71 @@
#include <klocale.h>
#include <klineedit.h>
+#include <ktextedit.h>
+#include <knuminput.h>
#include <kactionselector.h>
#include <tqlistbox.h>
#include <kpushbutton.h>
#include <tqpixmap.h>
#include <tqiconset.h>
+#include <tqlabel.h>
#include "realmpropertiesdialog.h"
-RealmPropertiesDialog::RealmPropertiesDialog(LDAPRealmConfig* realm, TQWidget* parent, const char* name)
- : KDialogBase(parent, name, true, i18n("Realm Properties"), Ok|Cancel, Ok, true), m_realmConfig(realm)
+RealmPropertiesDialog::RealmPropertiesDialog(LDAPRealmConfigList *realmList, TQString realmName, TQWidget* parent, const char* name)
+ : KDialogBase(parent, name, true, i18n("Realm Properties"), Ok|Cancel, Ok, true), m_realmList(realmList), m_realmName(realmName)
{
- m_base = new RealmPropertiesBase(this);
+ m_base = new BondRealmPage(this);
+
+ m_base->txtRealmName->setEnabled(false);
+ m_base->txtKDC->setEnabled(false);
+ m_base->txtKDCPort->setEnabled(false);
+ m_base->txtAdminServer->setEnabled(false);
+ m_base->txtAdminServerPort->setEnabled(false);
+
+ m_base->px_introSidebar->hide();
+
+ LDAPRealmConfig realm = (*m_realmList)[m_realmName];
+
+ // Load values into dialog
+ m_base->txtRealmName->setText(realm.name);
+ m_base->txtUIDOffset->setValue(realm.uid_offset);
+ m_base->txtGIDOffset->setValue(realm.gid_offset);
+ m_base->txtDomains->setText(realm.domain_mappings.join("\n"));
+ m_base->txtKDC->setText(realm.kdc);
+ m_base->txtKDCPort->setValue(realm.kdc_port);
+ m_base->txtAdminServer->setText(realm.admin_server);
+ m_base->txtAdminServerPort->setValue(realm.admin_server_port);
+ m_base->checkRequireEKU->setChecked(realm.pkinit_require_eku);
+ m_base->checkRequireKrbtgtOtherName->setChecked(realm.pkinit_require_krbtgt_otherName);
+ m_base->checkWin2k->setChecked(realm.win2k_pkinit);
+ m_base->checkWin2kPkinitRequireBinding->setChecked(realm.win2k_pkinit_require_binding);
+
+ setMainWidget(m_base);
}
-void RealmPropertiesDialog::slotOk()
-{
- // accept(); or reject();
+void RealmPropertiesDialog::slotOk() {
+ // Load values into realmcfg
+ LDAPRealmConfig realm = (*m_realmList)[m_realmName];
+
+ realm.name = m_base->txtRealmName->text();
+ realm.uid_offset = m_base->txtUIDOffset->value();
+ realm.gid_offset = m_base->txtGIDOffset->value();
+ realm.domain_mappings = TQStringList::split("\n", m_base->txtDomains->text(), FALSE);
+ realm.kdc = m_base->txtKDC->text();
+ realm.kdc_port = m_base->txtKDCPort->value();
+ realm.admin_server = m_base->txtAdminServer->text();
+ realm.admin_server_port = m_base->txtAdminServerPort->value();
+ realm.pkinit_require_eku = m_base->checkRequireEKU->isChecked();
+ realm.pkinit_require_krbtgt_otherName = m_base->checkRequireKrbtgtOtherName->isChecked();
+ realm.win2k_pkinit = m_base->checkWin2k->isChecked();
+ realm.win2k_pkinit_require_binding = m_base->checkWin2kPkinitRequireBinding->isChecked();
+
+ // Remove m_realmName and re-add it
+ m_realmList->remove(m_realmName);
+ m_realmList->insert(m_realmName, realm);
+
+ accept();
}
#include "realmpropertiesdialog.moc"
diff --git a/src/realmpropertiesdialog.h b/src/realmpropertiesdialog.h
index 4c10062..c696cf0 100644
--- a/src/realmpropertiesdialog.h
+++ b/src/realmpropertiesdialog.h
@@ -24,21 +24,22 @@
#include <kdialogbase.h>
#include "ldap.h"
-#include "realmpropertiesbase.h"
+#include "bondrealmpage.h"
class RealmPropertiesDialog : public KDialogBase
{
Q_OBJECT
public:
- RealmPropertiesDialog(LDAPRealmConfig* realm, TQWidget* parent = 0, const char* name = 0);
-
+ RealmPropertiesDialog(LDAPRealmConfigList *realmList, TQString realmName, TQWidget* parent = 0, const char* name = 0);
+
public slots:
void slotOk();
private:
- RealmPropertiesBase *m_base;
- LDAPRealmConfig* m_realmConfig;
+ BondRealmPage *m_base;
+ LDAPRealmConfigList* m_realmList;
+ TQString m_realmName;
};
#endif