Load/save realms

pull/1/head
Timothy Pearson 13 years ago
parent fd4d12151c
commit 96936f9f12

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

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

@ -56,7 +56,7 @@ class LDAPRealmConfig
bool win2k_pkinit_require_binding;
};
typedef TQValueList<LDAPRealmConfig> LDAPRealmConfigList;
typedef TQMap<TQString, LDAPRealmConfig> LDAPRealmConfigList;
class LDAPConfig: public KCModule
{

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

Loading…
Cancel
Save