From e2d9b461c364c36b12c713b20658ab9444587d43 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 11 Jun 2012 15:34:51 -0500 Subject: Add skeleton secondary realm wizard --- src/ldapcontroller.cpp | 57 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 15 deletions(-) (limited to 'src/ldapcontroller.cpp') diff --git a/src/ldapcontroller.cpp b/src/ldapcontroller.cpp index 2e93f11..8340902 100644 --- a/src/ldapcontroller.cpp +++ b/src/ldapcontroller.cpp @@ -51,7 +51,8 @@ #include "sha1.h" #include "ldapcontroller.h" -#include "primaryrealmwizard/realmwizard.h" +#include "primaryrealmwizard/primaryrealmwizard.h" +#include "secondaryrealmwizard/secondaryrealmwizard.h" #include "processingdialog.h" #include "ldapcontrollerconfigbase.h" @@ -146,32 +147,32 @@ LDAPController::~LDAPController() { void LDAPController::systemRoleChanged() { if (m_base->systemRole->currentItem() != m_prevRole) { - if (m_base->systemRole->currentItem() == ROLE_PRIMARY_REALM_CONTROLLER) { - // Verify that this workstation was not already bonded to an LDAP realm! - bool bonded = false; - TQStringList cfgRealms = m_systemconfig->groupList(); - for (TQStringList::Iterator it(cfgRealms.begin()); it != cfgRealms.end(); ++it) { - if ((*it).startsWith("LDAPRealm-")) { - m_systemconfig->setGroup(*it); - if (m_systemconfig->readBoolEntry("bonded", false) == true) { - bonded = true; - } + // Verify that this workstation was not already bonded to an LDAP realm! + bool bonded = false; + TQStringList cfgRealms = m_systemconfig->groupList(); + for (TQStringList::Iterator it(cfgRealms.begin()); it != cfgRealms.end(); ++it) { + if ((*it).startsWith("LDAPRealm-")) { + m_systemconfig->setGroup(*it); + if (m_systemconfig->readBoolEntry("bonded", false) == true) { + bonded = true; } } - + } + + if (m_base->systemRole->currentItem() == ROLE_PRIMARY_REALM_CONTROLLER) { if (bonded) { KMessageBox::error(0, i18n("You are already bonded to a realm!

Please unbond from all realms before selecting a Realm Controller role"), i18n("Common Sense Failure")); - m_base->systemRole->setCurrentItem(0); + m_base->systemRole->setCurrentItem(m_prevRole); } else { // Something will probably change save(); - RealmWizard realmwizard(this, m_fqdn, m_certconfig, this); + PrimaryRealmWizard realmwizard(this, m_fqdn, m_certconfig, this); if (realmwizard.exec() < 0) { // Wizard was cancelled // Back out all changes! - m_base->systemRole->setCurrentItem(ROLE_WORKSTATION); + m_base->systemRole->setCurrentItem(m_prevRole); save(); } else { @@ -185,8 +186,34 @@ void LDAPController::systemRoleChanged() { } else if (m_base->systemRole->currentItem() == ROLE_SECONDARY_REALM_CONTROLLER) { // RAJA FIXME +#if 0 KMessageBox::error(0, i18n("Secondary realm controller support is not yet available

If you want to see it implemented, contact the Trinity Desktop developers"), i18n("Feature Not Yet Available")); m_base->systemRole->setCurrentItem(m_prevRole); +#else + if (bonded) { + KMessageBox::error(0, i18n("You are already bonded to a realm!

Please unbond from all realms before selecting a Realm Controller role"), i18n("Common Sense Failure")); + m_base->systemRole->setCurrentItem(m_prevRole); + } + else { + // Something will probably change + save(); + + SecondaryRealmWizard realmwizard(this, m_fqdn, m_certconfig, this); + if (realmwizard.exec() < 0) { + // Wizard was cancelled + // Back out all changes! + m_base->systemRole->setCurrentItem(m_prevRole); + save(); + } + else { + // Wizard completed; commit changes + save(); + } + + // Something probably changed + load(); + } +#endif } else if (m_base->systemRole->currentItem() == ROLE_WORKSTATION) { if (KMessageBox::warningYesNo(this, i18n("WARNING
You are attempting to demote a realm controller

This action will PERMANENTLY DESTROY the realm directory stored on this machine

If you do not want to do this, select Cancel below"), i18n("Are you absolutely sure?"), TQString("Continue"), TQString("Cancel")) == KMessageBox::Yes) { -- cgit v1.2.3