From a63d48d3ea39fb5490a10fcf55b3b354b622622f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 May 2012 00:51:17 -0500 Subject: [PATCH] Import ldap login dialog and start adding ui bases to control module --- src/Makefile.am | 2 +- src/groupconfigbase.ui | 8 +-- src/ldap.cpp | 45 +++++++++----- src/ldap.h | 11 +++- src/ldapconfigbase.ui | 34 +++++------ src/ldaplogindlg.cpp | 45 ++++++++++++++ src/ldaplogindlg.h | 39 ++++++++++++ src/ldaplogindlgbase.ui | 129 ++++++++++++++++++++++++++++++++++++++++ src/ldappasswddlg.cpp | 49 +++++++++++++++ src/ldappasswddlg.h | 42 +++++++++++++ src/libtdeldap.cpp | 0 src/libtdeldap.h | 72 ++++++++++++++++++++++ src/userconfigbase.ui | 8 +-- 13 files changed, 440 insertions(+), 44 deletions(-) create mode 100644 src/ldaplogindlg.cpp create mode 100644 src/ldaplogindlg.h create mode 100644 src/ldaplogindlgbase.ui create mode 100644 src/ldappasswddlg.cpp create mode 100644 src/ldappasswddlg.h create mode 100644 src/libtdeldap.cpp create mode 100644 src/libtdeldap.h diff --git a/src/Makefile.am b/src/Makefile.am index 8a9cf31..b38ecd8 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_ldapmanager.la -kcm_ldapmanager_la_SOURCES = ldap.cpp ldapconfigbase.ui +kcm_ldapmanager_la_SOURCES = ldap.cpp ldapconfigbase.ui userconfigbase.ui groupconfigbase.ui libtdeldap.cpp ldaplogindlgbase.ui ldaplogindlg.cpp ldappasswddlg.cpp kcm_ldapmanager_la_LIBADD = -lkio $(LIB_TDEUI) kcm_ldapmanager_la_LDFLAGS = -avoid-version -module -no-undefined \ $(all_libraries) diff --git a/src/groupconfigbase.ui b/src/groupconfigbase.ui index d91cd72..721338a 100644 --- a/src/groupconfigbase.ui +++ b/src/groupconfigbase.ui @@ -70,7 +70,7 @@ - unnamed + unnamed_layoutwidget @@ -99,7 +99,7 @@ - unnamed + unnamed_layoutwidget @@ -107,7 +107,7 @@ - addToGroup + addToGroup Add @@ -115,7 +115,7 @@ - removeFromGroup + removeFromGroup Remove diff --git a/src/ldap.cpp b/src/ldap.cpp index eec7902..61351d1 100644 --- a/src/ldap.cpp +++ b/src/ldap.cpp @@ -36,48 +36,63 @@ #include "ldap.h" -typedef KGenericFactory ldapFactory; +typedef KGenericFactory LDAPConfigFactory; -K_EXPORT_COMPONENT_FACTORY( kcm_ldapmanager, ldapFactory("kcmldapmanager")) +K_EXPORT_COMPONENT_FACTORY( kcm_ldapmanager, LDAPConfigFactory("kcmldapmanager")) -ldap::ldap(TQWidget *parent, const char *name, const TQStringList&) +LDAPConfig::LDAPConfig(TQWidget *parent, const char *name, const TQStringList&) : KCModule(parent, name), myAboutData(0) { - // FIXME - // Add UI base widget to 'this' + TQVBoxLayout *layout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + base = new LDAPConfigBase(this); + layout->add(base); + + base->user_list->setAllColumnsShowFocus(true); + base->user_list->setFullWidth(true); + base->group_list->setAllColumnsShowFocus(true); + base->group_list->setFullWidth(true); + base->group_memberList->setAllColumnsShowFocus(true); + base->group_memberList->setFullWidth(true); + base->machine_list->setAllColumnsShowFocus(true); + base->machine_list->setFullWidth(true); load(); - KAboutData* about = new KAboutData("ldap", I18N_NOOP("TDE LDAP Manager"), "0.1", - I18N_NOOP("TDE LDAP Manager Control Panel Module"), + KAboutData* about = new KAboutData("ldap", I18N_NOOP("TDE LDAP Realm Manager"), "0.1", + I18N_NOOP("TDE LDAP Realm Manager Control Panel Module"), KAboutData::License_GPL, I18N_NOOP("(c) 2012 Timothy Pearson"), 0, 0); about->addAuthor("Timothy Pearson", 0, "kb9vqf@pearsoncomputing.net"); setAboutData( about ); + + processLockouts(); }; -ldap::~ldap() { +LDAPConfig::~LDAPConfig() { } -void ldap::load() { +void LDAPConfig::load() { kgs = new KGlobalSettings(); - KStandardDirs *ksd = new KStandardDirs(); } -void ldap::defaults() { +void LDAPConfig::defaults() { } -void ldap::save() { +void LDAPConfig::save() { } -int ldap::buttons() { +void LDAPConfig::processLockouts() { + // +} + +int LDAPConfig::buttons() { return KCModule::Apply|KCModule::Help; } -TQString ldap::quickHelp() const +TQString LDAPConfig::quickHelp() const { - return i18n("This module configures which LDAP realms TDE uses for authentication."); + return i18n("This module manages users, groups, and machines in LDAP realms."); } diff --git a/src/ldap.h b/src/ldap.h index 1c041c0..a6bf485 100644 --- a/src/ldap.h +++ b/src/ldap.h @@ -32,13 +32,13 @@ #include "ldapconfigbase.h" -class ldap: public KCModule +class LDAPConfig: public KCModule { Q_OBJECT public: - ldap( TQWidget *parent=0, const char *name=0, const TQStringList& = TQStringList() ); - ~ldap(); + LDAPConfig( TQWidget *parent=0, const char *name=0, const TQStringList& = TQStringList() ); + ~LDAPConfig(); virtual void load(); virtual void save(); @@ -47,9 +47,14 @@ class ldap: public KCModule virtual TQString quickHelp() const; virtual const KAboutData *aboutData() const { return myAboutData; }; + private slots: + void processLockouts(); + private: KAboutData *myAboutData; KGlobalSettings *kgs; + + LDAPConfigBase *base; }; #endif diff --git a/src/ldapconfigbase.ui b/src/ldapconfigbase.ui index 0516834..768c3c6 100644 --- a/src/ldapconfigbase.ui +++ b/src/ldapconfigbase.ui @@ -14,7 +14,7 @@ - unnamed + unnamed_grid1 @@ -32,7 +32,7 @@ - unnamed + unnamed_grid2 @@ -41,7 +41,7 @@ - unnamed + unnamed_label1 User Accounts in LDAP Realm @@ -119,7 +119,7 @@ - unnamed + unnamed_layoutwidget1 @@ -128,7 +128,7 @@ - unnamed + unnamed_grid3 @@ -165,11 +165,11 @@ - unnamed + unnamed_grid4 - unnamed + unnamed_label2 Login Name: @@ -185,7 +185,7 @@ - unnamed + unnamed_label3 UID: @@ -201,7 +201,7 @@ - unnamed + unnamed_label4 Primary Group: @@ -217,7 +217,7 @@ - unnamed + unnamed_label5 Real Name: @@ -233,7 +233,7 @@ - unnamed + unnamed_label6 Status: @@ -249,7 +249,7 @@ - unnamed + unnamed_label7 Secondary Groups: @@ -296,7 +296,7 @@ - unnamed + unnamed_grid5 @@ -305,7 +305,7 @@ - unnamed + unnamed_label8 Groups in LDAP Realm @@ -372,7 +372,7 @@ - unnamed + unnamed_layoutwidget2 @@ -381,7 +381,7 @@ - unnamed + unnamed_grid6 @@ -559,7 +559,7 @@ - unnamed + unnamed_layoutwidget3 diff --git a/src/ldaplogindlg.cpp b/src/ldaplogindlg.cpp new file mode 100644 index 0000000..2a3b835 --- /dev/null +++ b/src/ldaplogindlg.cpp @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ldaplogindlg.h" + +LDAPLogin::LDAPLogin(TQWidget *parent, const char *name ) : LDAPLoginDlg(parent,name) { + + px_introSidebar->setPixmap(UserIcon("step3.png")); +} + +LDAPLogin::~LDAPLogin(){ + // +} + +#include "ldaplogindlg.moc" diff --git a/src/ldaplogindlg.h b/src/ldaplogindlg.h new file mode 100644 index 0000000..c4b74f2 --- /dev/null +++ b/src/ldaplogindlg.h @@ -0,0 +1,39 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef LDAPLOGIN_H +#define LDAPLOGIN_H + +#include "ldaplogindlgbase.h" + +class TQStringList; + +/**LDAP login dialog + *@author Timothy Pearson + */ + +class LDAPLogin : public LDAPLoginDlg { + Q_OBJECT +public: + LDAPLogin(TQWidget *parent=0, const char *name=0); + ~LDAPLogin(); +}; + +#endif diff --git a/src/ldaplogindlgbase.ui b/src/ldaplogindlgbase.ui new file mode 100644 index 0000000..1b3b600 --- /dev/null +++ b/src/ldaplogindlgbase.ui @@ -0,0 +1,129 @@ + +LDAPLoginDlg + + + LDAPLoginDlg + + + + unnamed + + + + px_introSidebar + + + + 0 + 0 + 0 + 0 + + + + + 170 + 430 + + + + Panel + + + Sunken + + + true + + + 0 + + + + + yad_string + + + <h3>You're almost done!</h3> + + + + + passprompt + + + Please provide LDAP realm administrator credentials below to complete the bonding process + + + + + unnamed + + + Username + + + + + ldapAdminUsername + + + + + unnamed + + + Password + + + + + ldapAdminPassword + + + + + unnamed + + + LDAP Realm + + + + + ldapAdminRealm + + + + + Spacer6 + + + Vertical + + + Fixed + + + + 20 + 30 + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + + + + diff --git a/src/ldappasswddlg.cpp b/src/ldappasswddlg.cpp new file mode 100644 index 0000000..43d2764 --- /dev/null +++ b/src/ldappasswddlg.cpp @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ldappasswddlg.h" + +LDAPPasswordDialog::LDAPPasswordDialog(TQWidget* parent, const char* name) + : KDialogBase(parent, name, true, i18n("LDAP Authentication"), Ok|Cancel, Ok, true) +{ + m_base = new LDAPLogin(this); + + m_base->px_introSidebar->hide(); + m_base->yad_string->hide(); + + setMainWidget(m_base); +} + +void LDAPPasswordDialog::slotOk() { + accept(); +} + +#include "ldappasswddlg.moc" diff --git a/src/ldappasswddlg.h b/src/ldappasswddlg.h new file mode 100644 index 0000000..1869392 --- /dev/null +++ b/src/ldappasswddlg.h @@ -0,0 +1,42 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _LDAPPASSWORDDIALOG_H_ +#define _LDAPPASSWORDDIALOG_H_ + +#include + +#include "ldaplogindlg.h" + +class LDAPPasswordDialog : public KDialogBase +{ + Q_OBJECT + +public: + LDAPPasswordDialog(TQWidget* parent = 0, const char* name = 0); + +public slots: + void slotOk(); + +public: + LDAPLogin *m_base; +}; + +#endif diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/libtdeldap.h b/src/libtdeldap.h new file mode 100644 index 0000000..b0bfba2 --- /dev/null +++ b/src/libtdeldap.h @@ -0,0 +1,72 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _LIBTDELDAP_H_ +#define _LIBTDELDAP_H_ + +#include + +#include +#include +#include + +enum LDAPUserStatus { + USER_STATUS_ENABLED, + USER_STATUS_DISABLED +}; + +typedef TQValueList UserList; +typedef TQValueList GroupList; + +class LDAPUserInfo +{ + public: + TQString name; + uid_t uid; + TQString shell; + TQString homedir; + gid_t primary_gid; + GroupList grouplist; + LDAPUserStatus status; + TQDate password_last_changed; + bool password_expires; + TQDate password_expiration; + bool password_ages; + int new_password_interval; + int new_password_warn_interval; + int new_password_lockout_delay; + bool password_has_minimum_age; + int password_minimum_age; + + TQString realName; + TQString organization; + // FIXME + // Add other attributes (cubicle, phone number, etc) +}; + +class LDAPGroupInfo +{ + public: + TQString name; + gid_t gid; + UserList userlist; +}; + +#endif // _LIBTDELDAP_H_ \ No newline at end of file diff --git a/src/userconfigbase.ui b/src/userconfigbase.ui index 7daa871..b568067 100644 --- a/src/userconfigbase.ui +++ b/src/userconfigbase.ui @@ -60,10 +60,10 @@ - None + NoFrame - None + Plain @@ -194,7 +194,7 @@ homeDirectory - Directory + 18 @@ -389,7 +389,7 @@ NoFrame - None + Plain