[yast-commit] r48613 - in /trunk/ldap-server/src: LdapServer.pm agent/SlapdConfigAgent.cc agent/SlapdConfigAgent.h lib/backConfigTest.cpp lib/backConfigTest.h tree_structure.ycp widgets.ycp
Author: rhafer Date: Fri Jun 27 15:58:12 2008 New Revision: 48613 URL: http://svn.opensuse.org/viewcvs/yast?rev=48613&view=rev Log: Started work on Schema management Modified: trunk/ldap-server/src/LdapServer.pm trunk/ldap-server/src/agent/SlapdConfigAgent.cc trunk/ldap-server/src/agent/SlapdConfigAgent.h trunk/ldap-server/src/lib/backConfigTest.cpp trunk/ldap-server/src/lib/backConfigTest.h trunk/ldap-server/src/tree_structure.ycp trunk/ldap-server/src/widgets.ycp Modified: trunk/ldap-server/src/LdapServer.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapServer.pm?rev... ============================================================================== --- trunk/ldap-server/src/LdapServer.pm (original) +++ trunk/ldap-server/src/LdapServer.pm Fri Jun 27 15:58:12 2008 @@ -556,6 +556,16 @@ return $rc; } +BEGIN { $TYPEINFO {GetSchemaList} = ["function", [ "list" , "string"] ]; } +sub GetSchemaList +{ + my $self = @_; + y2milestone("GetSchemaList "); + my $rc = SCR->Read(".ldapserver.schemaList" ); + y2milestone( "SchemaList: ".Data::Dumper->Dump([$rc]) ); + return $rc; +} + BEGIN { $TYPEINFO {UpdateDatabase} = ["function", "boolean", "integer", [ "map" , "string", "string"] ]; } sub UpdateDatabase { Modified: trunk/ldap-server/src/agent/SlapdConfigAgent.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/agent/SlapdConfig... ============================================================================== --- trunk/ldap-server/src/agent/SlapdConfigAgent.cc (original) +++ trunk/ldap-server/src/agent/SlapdConfigAgent.cc Fri Jun 27 15:58:12 2008 @@ -70,7 +70,12 @@ { y2milestone("read databases"); return ReadDatabases(path->at(1), arg, opt); - } + } + else if ( path->component_str(0) == "schemaList" ) + { + y2milestone("read databases"); + return ReadSchemaList(path->at(1), arg, opt); + } else if ( path->component_str(0) == "database" ) { y2milestone("read database"); @@ -361,6 +366,26 @@ return YCPNull(); } +YCPValue SlapdConfigAgent::ReadSchemaList( const YCPPath &path, + const YCPValue &arg, + const YCPValue &opt) +{ + y2milestone("Path %s Length %ld ", path->toString().c_str(), + path->length()); + + OlcSchemaList schemaList = olc.getSchemaNames(); +// if ( databases.size() == 0 ) +// { +// databases = olc.getDatabases(); +// } + OlcSchemaList::const_iterator i; + YCPList schema; + for (i = schemaList.begin(); i != schemaList.end(); i++ ) + { + schema.add( YCPString( (*i)->getName() ) ); + } + return schema; +} YCPBoolean SlapdConfigAgent::WriteGlobal( const YCPPath &path, const YCPValue &arg, const YCPValue &arg2) Modified: trunk/ldap-server/src/agent/SlapdConfigAgent.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/agent/SlapdConfig... ============================================================================== --- trunk/ldap-server/src/agent/SlapdConfigAgent.h (original) +++ trunk/ldap-server/src/agent/SlapdConfigAgent.h Fri Jun 27 15:58:12 2008 @@ -37,12 +37,17 @@ protected: YCPValue ReadGlobal( const YCPPath &path, - const YCPValue &arg = YCPNull(), - const YCPValue &opt = YCPNull()); + const YCPValue &arg = YCPNull(), + const YCPValue &opt = YCPNull()); YCPValue ReadDatabases( const YCPPath &path, - const YCPValue &arg = YCPNull(), - const YCPValue &opt = YCPNull()); + const YCPValue &arg = YCPNull(), + const YCPValue &opt = YCPNull()); + + YCPValue ReadSchemaList( const YCPPath &path, + const YCPValue &arg = YCPNull(), + const YCPValue &opt = YCPNull()); + YCPValue ReadDatabase( const YCPPath &path, const YCPValue &arg = YCPNull(), const YCPValue &opt = YCPNull()); Modified: trunk/ldap-server/src/lib/backConfigTest.cpp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/lib/backConfigTes... ============================================================================== --- trunk/ldap-server/src/lib/backConfigTest.cpp (original) +++ trunk/ldap-server/src/lib/backConfigTest.cpp Fri Jun 27 15:58:12 2008 @@ -254,6 +254,27 @@ m_dbEntryChanged.addAttribute(LDAPAttribute("cn", "schema")); } +OlcSchemaConfig::OlcSchemaConfig(const LDAPEntry &e) : OlcConfigEntry(e) +{ + std::cout << "OlcSchemaConfig::OlcSchemaConfig(const LDAPEntry &e) : OlcConfigEntry(e)" << std::endl; + std::string name(this->getStringValue("cn")); + if ( name[0] == '{' ) + { + std::string::size_type pos = name.find('}'); + std::istringstream indexstr(name.substr(1, pos-1)); + indexstr >> entryIndex; + m_name = name.substr( pos+1, std::string::npos ); + } else { + m_name = name; + entryIndex = 0; + } +} + +const std::string& OlcSchemaConfig::getName() const +{ + return m_name; +} + OlcTlsSettings OlcGlobalConfig::getTlsSettings() const { std::cout << "OlcTlsSettings OlcGlobalConfig::getTlsSettings() const " << std::endl; @@ -357,7 +378,7 @@ else if ( OlcConfigEntry::isScheamEntry(e) ) { std::cerr << "creating OlcSchemaConfig" << std::endl; - return new OlcConfigEntry(e); + return new OlcSchemaConfig(e); } else if ( OlcConfigEntry::isDatabaseEntry(e) ) { @@ -709,6 +730,28 @@ return res; } +OlcSchemaList OlcConfig::getSchemaNames() +{ + OlcSchemaList res; + try { + StringList attrs; + attrs.add("cn"); + LDAPSearchResults *sr = m_lc->search( "cn=schema,cn=config", + LDAPConnection::SEARCH_ONE, "objectclass=olcSchemaConfig", attrs ); + LDAPEntry *entry; + while ( entry = sr->getNext() ) + { + std::cout << "Got Schema Entry: " << entry->getDN() << std::endl; + boost::shared_ptr<OlcSchemaConfig> olce(new OlcSchemaConfig(*entry)); + res.push_back(olce); + } + } catch (LDAPException e ) { + std::cout << e << std::endl; + throw; + } + return res; +} + OlcTlsSettings::OlcTlsSettings( const OlcGlobalConfig &ogc ) : m_crlCheck(0), m_verifyCient(0) { Modified: trunk/ldap-server/src/lib/backConfigTest.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/lib/backConfigTes... ============================================================================== --- trunk/ldap-server/src/lib/backConfigTest.h (original) +++ trunk/ldap-server/src/lib/backConfigTest.h Fri Jun 27 15:58:12 2008 @@ -125,18 +125,11 @@ { public: OlcSchemaConfig(); -}; + OlcSchemaConfig(const LDAPEntry &e); + const std::string& getName() const; -typedef std::list<boost::shared_ptr<OlcDatabase> > OlcDatabaseList; -class OlcConfig { - public: - OlcConfig(LDAPConnection *lc=0 ); - boost::shared_ptr<OlcGlobalConfig> getGlobals(); - void setGlobals( OlcGlobalConfig &olcg); - void updateEntry( const OlcConfigEntry &oce ); - OlcDatabaseList getDatabases(); private: - LDAPConnection *m_lc; + std::string m_name; }; class OlcTlsSettings { @@ -171,4 +164,23 @@ std::string m_crlFile; }; +typedef std::list<boost::shared_ptr<OlcDatabase> > OlcDatabaseList; +typedef std::list<boost::shared_ptr<OlcSchemaConfig> > OlcSchemaList; +class OlcConfig { + + public: + OlcConfig(LDAPConnection *lc=0 ); + + boost::shared_ptr<OlcGlobalConfig> getGlobals(); + OlcDatabaseList getDatabases(); + OlcSchemaList getSchemaNames(); + + void setGlobals( OlcGlobalConfig &olcg); + void updateEntry( const OlcConfigEntry &oce ); + + private: + LDAPConnection *m_lc; +}; + + #endif /* BACK_CONFIG_TEST_H */ Modified: trunk/ldap-server/src/tree_structure.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/tree_structure.yc... ============================================================================== --- trunk/ldap-server/src/tree_structure.ycp (original) +++ trunk/ldap-server/src/tree_structure.ycp Fri Jun 27 15:58:12 2008 @@ -74,12 +74,12 @@ ** global schema handlers *****************************/ -void show_new_schemalist( list<string> l, string select_item ) +void update_schemalist( list<string> l, string select_item ) { if( l == nil ) l = []; widget_map["g_schema","inclist"] = l; /* schema file selection box title */ - UI::ReplaceWidget( `rp_schemalist, `SelectionBox( `id( `sb_schemalist ), _("Included &Schema Files"), l ) ); + UI::ChangeWidget( `sb_schemalist, `Items, l ); if( select_item != nil ) { UI::ChangeWidget( `sb_schemalist, `CurrentItem, select_item ); @@ -89,9 +89,9 @@ define boolean cb_read_schema() ``{ y2milestone( "calling schema read handler" ); -// list<string> inclist = LdapServer::ReadSchemaIncludeList(); + list<string> inclist = LdapServer::GetSchemaList(); // //store current include list for later order changes -// show_new_schemalist( inclist, nil ); + update_schemalist( inclist, nil ); return true; } @@ -194,7 +194,7 @@ i = i + 1; } } - show_new_schemalist( new_inclist, current_item ); + update_schemalist( new_inclist, current_item ); } else if( handler_cmd == `pb_add ) { //add a new file to the list @@ -211,13 +211,13 @@ } inclist = add( inclist, new_item ); - show_new_schemalist( inclist, new_item ); + update_schemalist( inclist, new_item ); } else if( handler_cmd == `pb_delete ) { if( current_item == nil ) return true; inclist = remove( inclist, find_pos( inclist, current_item ) ); - show_new_schemalist( inclist, nil ); + update_schemalist( inclist, nil ); } return true; } @@ -340,50 +340,7 @@ UI::ChangeWidget( `te_ca_file, `Value, tls["caCertFile"]:"" ); UI::ChangeWidget( `te_cert_file, `Value, tls["certFile"]:"" ); UI::ChangeWidget( `te_key_file, `Value, tls["certKeyFile"]:"" ); -// map<string,string> importPaths = LdapServer::ReadImportCertificates(); -// boolean use_common_ca = LdapServer::ReadConfigureCommonServerCertificate(); -// map<string,string> tlsSettings = (map<string,string>)LdapServer::ReadTlsSettings(); -// -// /* tls configuration info text 1/4 */ -// string info = HTML::Bold( _("Current Configuration:") )+HTML::Newline()+HTML::ListStart(); -// foreach( string key, string val, tlsSettings, { -// if ( val != nil ) { -// info = info + HTML::ListItem( HTML::Bold( key ) + ": " + val ); -// } -// } ); -// info = info + HTML::ListEnd() + HTML::Newline(); -// /* tls configuration info text 2/4 */ -// info = info + HTML::Bold( _("The following changes will be made:") )+HTML::Newline() + HTML::Newline(); -// -// if( use_common_ca ) -// { -// /* tls configuration info text 3/4 */ -// info = info + _("Configuring Common Server Certificate") + HTML::Newline(); -// } else if( haskey( importPaths, "ServerCertificateFile" ) ) -// { -// /* tls configuration info text 4/4 */ -// info = info + _("Importing the Following Certificates:") + HTML::Newline() + HTML::ListStart(); -// foreach( string key, string val, importPaths, { -// info = info + HTML::ListItem( HTML::Bold( key ) + ": " + val ); -// } ); -// -// info = info + HTML::ListEnd(); -// } -// -// UI::ChangeWidget( `rt_tls_info, `Value, info ); -// -// if( use_common_ca -// || haskey( importPaths, "ServerCertificateFile" ) -// || ( tlsSettings["TLSCertificateFile"]:nil != nil && tlsSettings["TLSCertificateKeyFile"]:nil != nil ) -// ) -// { -// UI::ChangeWidget( `rb_yes, `Value, true ); -// } else -// { -// UI::ChangeWidget( `rb_no, `Value, true ); -// UI::ChangeWidget( `rt_tls_info, `Enabled, false ); -// UI::ChangeWidget( `pb_edit, `Enabled, false ); -// } + return true; } Modified: trunk/ldap-server/src/widgets.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/widgets.ycp?rev=4... ============================================================================== --- trunk/ldap-server/src/widgets.ycp (original) +++ trunk/ldap-server/src/widgets.ycp Fri Jun 27 15:58:12 2008 @@ -77,9 +77,7 @@ term schemaWidget = `HBox( `VBox( - `ReplacePoint( - `id( `rp_schemalist ), `Empty() - ), + `SelectionBox( `id( `sb_schemalist ), _("Included &Schema Files"), [] ), `Left( `HBox( `PushButton( `id( `pb_add ), Label::AddButton() ), -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
rhafer@svn.opensuse.org