Add realm properties editor

pull/1/head
Timothy Pearson 13 years ago
parent 37acc91cac
commit 9dfe673336

@ -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)

@ -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"

@ -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

@ -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;
}

@ -78,6 +78,7 @@ class LDAPConfig: public KCModule
void processLockouts();
void bondToNewRealm();
void removeRealm();
void realmProperties();
private:
void updateRealmList();

@ -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>

@ -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"

@ -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

Loading…
Cancel
Save