[yast-commit] r48616 - in /trunk/ldap-server/src: LdapServer.pm agent/SlapdConfigAgent.cc lib/backConfigTest.cpp lib/backConfigTest.h tree_structure.ycp
Author: rhafer Date: Fri Jun 27 15:58:27 2008 New Revision: 48616 URL: http://svn.opensuse.org/viewcvs/yast?rev=48616&view=rev Log: delete implementation for Schema Entries Modified: trunk/ldap-server/src/LdapServer.pm trunk/ldap-server/src/agent/SlapdConfigAgent.cc trunk/ldap-server/src/lib/backConfigTest.cpp trunk/ldap-server/src/lib/backConfigTest.h trunk/ldap-server/src/tree_structure.ycp Modified: trunk/ldap-server/src/LdapServer.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapServer.pm?rev=48616&r1=48615&r2=48616&view=diff ============================================================================== --- trunk/ldap-server/src/LdapServer.pm (original) +++ trunk/ldap-server/src/LdapServer.pm Fri Jun 27 15:58:27 2008 @@ -573,7 +573,17 @@ my $rc = SCR->Write(".ldapserver.schema.addFromLdif", $file); - return 1; + return $rc; +} + +BEGIN { $TYPEINFO {RemoveFromSchemaList} = ["function", "boolean", "string" ]; } +sub RemoveFromSchemaList +{ + my ($self, $name) = @_; + + my $rc = SCR->Write(".ldapserver.schema.remove", $name); + + return $rc; } BEGIN { $TYPEINFO {UpdateDatabase} = ["function", "boolean", "integer", [ "map" , "string", "string"] ]; } Modified: trunk/ldap-server/src/agent/SlapdConfigAgent.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/agent/SlapdConfigAgent.cc?rev=48616&r1=48615&r2=48616&view=diff ============================================================================== --- trunk/ldap-server/src/agent/SlapdConfigAgent.cc (original) +++ trunk/ldap-server/src/agent/SlapdConfigAgent.cc Fri Jun 27 15:58:27 2008 @@ -389,7 +389,10 @@ YCPList resultList; for (i = schema.begin(); i != schema.end(); i++ ) { - resultList.add( YCPString( (*i)->getName() ) ); + if (! (*i)->getName().empty() ) + { + resultList.add( YCPString( (*i)->getName() ) ); + } } return resultList; } @@ -553,6 +556,21 @@ entry = ldif.getEntryRecord(); schema.push_back( boost::shared_ptr<OlcSchemaConfig>(new OlcSchemaConfig(oldEntry, entry)) ); } + return YCPBoolean(true); + } + if ( subpath == "remove" ) + { + std::string name = arg->asString()->value_cstr(); + y2milestone("remove Schema Entry: %s", name.c_str()); + OlcSchemaList::const_iterator i; + for (i = schema.begin(); i != schema.end(); i++ ) + { + if ( (*i)->getName() == name ) + { + (*i)->clearChangedEntry(); + } + } + return YCPBoolean(true); } return YCPBoolean(false); } Modified: trunk/ldap-server/src/lib/backConfigTest.cpp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/lib/backConfigTest.cpp?rev=48616&r1=48615&r2=48616&view=diff ============================================================================== --- trunk/ldap-server/src/lib/backConfigTest.cpp (original) +++ trunk/ldap-server/src/lib/backConfigTest.cpp Fri Jun 27 15:58:27 2008 @@ -285,6 +285,12 @@ } } +void OlcSchemaConfig::clearChangedEntry() +{ + OlcConfigEntry::clearChangedEntry(); + m_name = ""; +} + const std::string& OlcSchemaConfig::getName() const { return m_name; @@ -439,6 +445,12 @@ { } +void OlcConfigEntry::clearChangedEntry() +{ + m_dbEntryChanged = LDAPEntry(); +} + + std::map<std::string, std::list<std::string> > OlcDatabase::toMap() const { std::map<std::string, std::list<std::string> > resMap; @@ -585,6 +597,10 @@ { return ( this->getDn().empty() ); } +bool OlcConfigEntry::isDeletedEntry() const +{ + return ( (!this->getDn().empty()) && this->getUpdatedDn().empty() ); +} LDAPModList OlcConfigEntry::entryDifftoMod() const { LDAPAttributeList::const_iterator i = m_dbEntry.getAttributes()->begin(); @@ -723,6 +739,8 @@ if ( oce.isNewEntry () ) { m_lc->add(&oce.getChangedEntry()); + } else if (oce.isDeletedEntry() ) { + m_lc->del(oce.getDn()); } else { LDAPModList ml = oce.entryDifftoMod(); if ( ! ml.empty() ) { Modified: trunk/ldap-server/src/lib/backConfigTest.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/lib/backConfigTest.h?rev=48616&r1=48615&r2=48616&view=diff ============================================================================== --- trunk/ldap-server/src/lib/backConfigTest.h (original) +++ trunk/ldap-server/src/lib/backConfigTest.h Fri Jun 27 15:58:27 2008 @@ -25,10 +25,16 @@ inline std::string getDn() const { return m_dbEntry.getDN(); } + inline std::string getUpdatedDn() const { + return m_dbEntryChanged.getDN(); + } inline const LDAPEntry& getChangedEntry() const { return m_dbEntryChanged; } + virtual void clearChangedEntry(); + bool isNewEntry() const; + bool isDeletedEntry() const; LDAPModList entryDifftoMod() const; @@ -133,6 +139,7 @@ OlcSchemaConfig(); OlcSchemaConfig(const LDAPEntry &e); OlcSchemaConfig(const LDAPEntry &e1, const LDAPEntry &e2); + virtual void clearChangedEntry(); const std::string& getName() const; private: Modified: trunk/ldap-server/src/tree_structure.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/tree_structure.ycp?rev=48616&r1=48615&r2=48616&view=diff ============================================================================== --- trunk/ldap-server/src/tree_structure.ycp (original) +++ trunk/ldap-server/src/tree_structure.ycp Fri Jun 27 15:58:27 2008 @@ -159,7 +159,7 @@ } else if( handler_cmd == `pb_delete ) { if( current_item == nil ) return true; -// inclist = remove( inclist, find_pos( inclist, current_item ) ); + LdapServer::RemoveFromSchemaList(current_item); list<string> inclist = LdapServer::GetSchemaList(); update_schemalist( inclist, nil ); } -- 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