summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-05-18 03:51:53 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-05-18 03:51:53 -0500
commit96936f9f1272296b22c7ed6d6e68e944ba78a6b6 (patch)
treeb0637173249a4f0ec84013658400f63d59ae58d4 /src
parentfd4d12151ca6b034307f8eba345fbef97a3cbfaf (diff)
downloadkcmldap-96936f9f1272296b22c7ed6d6e68e944ba78a6b6.tar.gz
kcmldap-96936f9f1272296b22c7ed6d6e68e944ba78a6b6.zip
Load/save realms
Diffstat (limited to 'src')
-rw-r--r--src/bondwizard.cpp6
-rw-r--r--src/ldap.cpp79
-rw-r--r--src/ldap.h2
-rw-r--r--src/ldapconfigbase.ui2
4 files changed, 80 insertions, 9 deletions
diff --git a/src/bondwizard.cpp b/src/bondwizard.cpp
index b0fe2b7..3a7fc17 100644
--- a/src/bondwizard.cpp
+++ b/src/bondwizard.cpp
@@ -113,20 +113,20 @@ bool BondWizard::askClose(){
*/
void BondWizard::reject(){
if (askClose()){
- exit(0);
+ done(0);
}
}
void BondWizard::closeEvent(TQCloseEvent* e){
if ( askClose() )
- exit(0);
+ done(0);
else
e->ignore();
}
/** maybe call a dialog that the wizard has finished. */
void BondWizard::accept(){
- exit(0);
+ done(0);
}
/** calls all save functions after resetting all features/ OS/ theme selections to Trinity default */
diff --git a/src/ldap.cpp b/src/ldap.cpp
index 7038989..861ed40 100644
--- a/src/ldap.cpp
+++ b/src/ldap.cpp
@@ -103,9 +103,35 @@ void LDAPConfig::load(bool useDefaults )
// Load realms
TQStringList cfgRealms = systemconfig->groupList();
- for (TQStringList::Iterator i(cfgRealms.begin()); i != cfgRealms.end(); ++i) {
- (void)new TQListViewItem(base->ldapRealmList, "RAJA", *i);
+ for (TQStringList::Iterator it(cfgRealms.begin()); it != cfgRealms.end(); ++it) {
+ if ((*it).startsWith("LDAPRealm-")) {
+ systemconfig->setGroup(*it);
+ TQString realmName=*it;
+ realmName.remove(strlen("LDAPRealm-"));
+ if (!m_realms.contains(realmName)) {
+ // Read in realm data
+ LDAPRealmConfig realmcfg;
+ realmcfg.name = realmName;
+ realmcfg.bonded = systemconfig->readBoolEntry("bonded");
+ realmcfg.uid_offset = systemconfig->readNumEntry("uid_offset");
+ realmcfg.gid_offset = systemconfig->readNumEntry("gid_offset");
+ realmcfg.domain_mappings = systemconfig->readListEntry("domain_mappings");
+ realmcfg.kdc = systemconfig->readEntry("kdc");
+ realmcfg.kdc_port = systemconfig->readNumEntry("kdc_port");
+ realmcfg.admin_server = systemconfig->readEntry("admin_server");
+ realmcfg.admin_server_port = systemconfig->readNumEntry("admin_server_port");
+ realmcfg.pkinit_require_eku = systemconfig->readBoolEntry("pkinit_require_eku");
+ realmcfg.pkinit_require_krbtgt_otherName = systemconfig->readBoolEntry("pkinit_require_krbtgt_otherName");
+ realmcfg.win2k_pkinit = systemconfig->readBoolEntry("win2k_pkinit");
+ realmcfg.win2k_pkinit_require_binding = systemconfig->readBoolEntry("win2k_pkinit_require_binding");
+ // Add realm to lists
+ m_realms.insert(realmName, realmcfg);
+ (void)new TQListViewItem(base->ldapRealmList, ((realmcfg.bonded)?i18n("Bonded"):i18n("Deactivated")), realmName);
+ }
+ }
}
+
+ processLockouts();
emit changed(useDefaults);
}
@@ -115,20 +141,65 @@ void LDAPConfig::defaults() {
}
void LDAPConfig::save() {
-
+ // Write system configuration
+ systemconfig->setGroup(NULL);
+ systemconfig->writeEntry("EnableLDAP", base->systemEnableSupport->isChecked());
+
+ LDAPRealmConfigList::Iterator it;
+ for (it = m_realms.begin(); it != m_realms.end(); ++it) {
+ LDAPRealmConfig realmcfg = it.data();
+ TQString configRealmName = realmcfg.name;
+ configRealmName.prepend("LDAPRealm-");
+ systemconfig->setGroup(configRealmName);
+ // Save realm settings
+ systemconfig->writeEntry("bonded", realmcfg.bonded);
+ systemconfig->writeEntry("uid_offset", realmcfg.uid_offset);
+ systemconfig->writeEntry("gid_offset", realmcfg.gid_offset);
+ systemconfig->writeEntry("domain_mappings", realmcfg.domain_mappings);
+ systemconfig->writeEntry("kdc", realmcfg.kdc);
+ systemconfig->writeEntry("kdc_port", realmcfg.kdc_port);
+ systemconfig->writeEntry("admin_server", realmcfg.admin_server);
+ systemconfig->writeEntry("admin_server_port", realmcfg.admin_server_port);
+ systemconfig->writeEntry("pkinit_require_eku", realmcfg.pkinit_require_eku);
+ systemconfig->writeEntry("pkinit_require_krbtgt_otherName", realmcfg.pkinit_require_krbtgt_otherName);
+ systemconfig->writeEntry("win2k_pkinit", realmcfg.win2k_pkinit);
+ systemconfig->writeEntry("win2k_pkinit_require_binding", realmcfg.win2k_pkinit_require_binding);
+ }
}
void LDAPConfig::processLockouts() {
bool panelIsEnabled = base->systemEnableSupport->isChecked();
base->groupRealms->setEnabled(panelIsEnabled);
+
+ TQListViewItem *selrealm = base->ldapRealmList->selectedItem();
+ if (selrealm) {
+ base->btnBondRealm->setEnabled(true);
+ base->btnReBondRealm->setEnabled(true);
+ base->btnDeactivateRealm->setEnabled(true); // RAJA FIXME only if realm is bonded
+ base->btnRemoveRealm->setEnabled(true); // RAJA FIXME only if realm is not bonded
+ base->btnRealmProperties->setEnabled(true); // RAJA FIXME only if realm is not bonded
+ }
+ else {
+ base->btnBondRealm->setEnabled(true);
+ base->btnReBondRealm->setEnabled(false);
+ base->btnDeactivateRealm->setEnabled(false);
+ base->btnRemoveRealm->setEnabled(false);
+ base->btnRealmProperties->setEnabled(false);
+ }
}
void LDAPConfig::bondToNewRealm() {
// RAJA FIXME
+ // Something will probably change
+ save();
+
BondWizard *bondwizard = new BondWizard(this);
- bondwizard->show();
+ bondwizard->exec();
+
+ // Something probably changed
+ load();
}
int LDAPConfig::buttons() {
diff --git a/src/ldap.h b/src/ldap.h
index f56e24d..370018e 100644
--- a/src/ldap.h
+++ b/src/ldap.h
@@ -56,7 +56,7 @@ class LDAPRealmConfig
bool win2k_pkinit_require_binding;
};
-typedef TQValueList<LDAPRealmConfig> LDAPRealmConfigList;
+typedef TQMap<TQString, LDAPRealmConfig> LDAPRealmConfigList;
class LDAPConfig: public KCModule
{
diff --git a/src/ldapconfigbase.ui b/src/ldapconfigbase.ui
index de0b0d7..ef5bd4f 100644
--- a/src/ldapconfigbase.ui
+++ b/src/ldapconfigbase.ui
@@ -106,7 +106,7 @@
</widget>
<widget class="KPushButton" row="1" column="1">
<property name="name">
- <cstring>btnUnBondRealm</cstring>
+ <cstring>btnReBondRealm</cstring>
</property>
<property name="text">
<string>Re-Bond to Realm</string>