From a180afe38d26bad35bcfd1dcd507fdb3ff94fba1 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 2 Jun 2010 09:03:37 +0000 Subject: [PATCH] Removed dynamic group plugin from gosa-plugins -It is now part of gosa-core. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18829 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../addons/dyngroup/classDynamicLdapGroup.inc | 365 ------------------ .../dyngroup/addons/dyngroup/dyngroup.tpl | 30 -- gosa-plugins/dyngroup/contrib/README | 100 ----- .../locale/de/LC_MESSAGES/messages.po | 52 --- .../locale/fr/LC_MESSAGES/messages.po | 43 --- gosa-plugins/dyngroup/locale/messages.po | 42 -- gosa-plugins/dyngroup/plugin.dsc | 8 - 7 files changed, 640 deletions(-) delete mode 100644 gosa-plugins/dyngroup/addons/dyngroup/classDynamicLdapGroup.inc delete mode 100644 gosa-plugins/dyngroup/addons/dyngroup/dyngroup.tpl delete mode 100644 gosa-plugins/dyngroup/contrib/README delete mode 100644 gosa-plugins/dyngroup/locale/de/LC_MESSAGES/messages.po delete mode 100644 gosa-plugins/dyngroup/locale/fr/LC_MESSAGES/messages.po delete mode 100644 gosa-plugins/dyngroup/locale/messages.po delete mode 100644 gosa-plugins/dyngroup/plugin.dsc diff --git a/gosa-plugins/dyngroup/addons/dyngroup/classDynamicLdapGroup.inc b/gosa-plugins/dyngroup/addons/dyngroup/classDynamicLdapGroup.inc deleted file mode 100644 index 6fcf63bb4..000000000 --- a/gosa-plugins/dyngroup/addons/dyngroup/classDynamicLdapGroup.inc +++ /dev/null @@ -1,365 +0,0 @@ -gmail.com - * @version 0.01 - */ -class DynamicLdapGroup extends plugin -{ - - /** - * The attribute that will use GOsa to store LDAP URI. - * @var array - */ - public $attributes = array('labeledURI'); - - /** - * The objectClass that will use GOsa to identify a group as dynamic. - * @var array - */ - public $objectclasses = array('labeledURIObject'); - - /** - * Default value for the corresponding attribute found in the $this->attributes - * array of this plugin. - * @var string - */ - public $labeledURI = array(); - public $labeledURIparsed = array(); - public $labeledURIdefault = 'ldap:///dc=example,dc=com?memberUid?sub?(objectClass=posixGroup)'; - - public $scopes = array('base','one','sub'); - - /** - * Store values of memberUrl. - * @var Array - */ - private $_memberUrls = Array(); - - public $orig_dn =""; - - /** - * Create this object. - * @param Array $config GOsa config. - * @param string $dn Current DN. - */ - public function __construct ($config, $dn) - { - parent::__construct($config, $dn); - - // Load labeledURI values. - $this->labeledURI = array(); - if(!$this->is_account){ - $this->labeledURI[] = str_replace('dc=example,dc=com', LDAP::fix($this->dn), $this->labeledURIdefault); - }elseif(isset($this->attrs['labeledURI'])){ - for($i =0; $i < $this->attrs['labeledURI']['count']; $i++) { - $this->labeledURI[] = $this->attrs['labeledURI'][$i]; - } - } - - // Parse labeledURI entries - $this->labeledURIparsed = array(); - foreach($this->labeledURI as $entry){ - list($base,$attr,$scope,$filter) = preg_split("/\?/",$entry); - - // Ignore entries that do not have a valid scope value (one,base,sub) - if(!in_array($scope,array('base','one','sub'))) continue; - - // Append parsed uri - $scope = array_search($scope,$this->scopes); - $this->labeledURIparsed[] = array('base' => $base, 'attr' => $attr, 'scope' => $scope,'filter' => $filter); - } - - // Save dn, to be able the check for object movements - put this in plugin::move - $this->orig_dn = $this->dn; - } - - - public function check () - { - $messages = plugin::check(); - - // At least one entry is required. - if(!count($this->labeledURIparsed)){ - $messages[] = msgPool::required(_("Labeled Uri")); - } - - // Check entries - foreach($this->labeledURIparsed as $key => $entry){ - $nr = $key +1; - - // A base is required - if(empty($entry['base'])){ - $messages[] = msgPool::required(_("Base")." {$nr}"); - } - - // Check for invalid attributes - if(empty($entry['attr'])){ - $messages[] = msgPool::required(_("Attribute")." {$nr}"); - }elseif(in_array(strtolower($entry['attr']), array('objectclass'))){ - $messages[] = msgPool::reserved(_("Attribute")." {$nr}"); - } - - // A filter is required - if(empty($entry['filter'])){ - $messages[] = msgPool::required(_("Filter")." {$nr}"); - }else{ - - // Check if filter is valid - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search($entry['filter']); - if(!$ldap->success()){ - $messages[] = sprintf(_("The given filter '%s' for entry %s seems to be invalid!"), - bold($entry['filter']), $nr); - } - } - } - - return($messages); - } - - - /** - * Execute this plugin. - * @return string HTML to print. - */ - public function execute () - { - // - // Are we trying to modify state of this group ? If so, - // we can edit the current object. - // - if (isset($_POST['modify_state'])) - { - $this->is_account = !$this->is_account; - } - - // - // Display a message if this feature is disabled. - // - if (!$this->is_account) - { - return $this->show_disable_header(msgPool::addFeaturesButton(_("Dynamic object")), msgPool::featuresDisabled(_("Dynamic object"))); - } - $display = $this->show_disable_header(msgPool::removeFeaturesButton(_("Dynamic object")), msgPool::featuresEnabled(_("Dynamic object"))); - - // Display values. - // - $smarty = get_smarty(); - $smarty->assign('labeledURIparsed', $this->labeledURIparsed); - $smarty->assign('scopes', $this->scopes); - $display .= $smarty->fetch(get_template_path('dyngroup.tpl', TRUE, dirname(__FILE__))); - return $display; - } - - - - /** - * This plugin does nothing when this method is invoked. - */ - public function remove_from_parent () - { - parent::remove_from_parent(); - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $ldap->modify($this->attrs); - if(!$ldap->success()){ - msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class())); - } - return; - } - - - /** - * This function is called when tab is undisplayed. For example, the current user - * wants to change other settings of this group, but not save it to the LDAP - * directory directly. - */ - public function save_object () - { - parent::save_object(); - - // Add a new labeled Uri - if(isset($_POST['addUri'])){ - $this->labeledURIparsed[] = - array( - 'base' => 'ldap:///'.$this->dn, - 'attr' => 'memberUid', - 'scope' => 2, - 'filter' => '(objectClass=posixGroup)'); - } - - // Remove a labeled Uri and get posts - foreach($this->labeledURIparsed as $key => $data){ - foreach(array('scope','attr','filter','base') as $attr){ - if(isset($_POST[$attr.'_'.$key])){ - $this->labeledURIparsed[$key][$attr] = get_post($attr.'_'.$key); - } - } - - // Remove labeled uri if requested - if(isset($_POST['delUri_'.$key])){ - unset($this->labeledURIparsed[$key]); - } - } - $this->labeledURIparsed = array_values($this->labeledURIparsed); - } - - - /** - * That will add additionnal information into the current LDAP entry. - * If this plugin is disable, then it will remove any data that references - * this plugin into the LDAP directory. - * @return boolean - */ - public function save () - { - // Build up labeledUri entries - $this->labeledURI = array(); - foreach($this->labeledURIparsed as $entry){ - $scope = $this->scopes[$entry['scope']]; - $filter = $entry['filter']; - $filter = '('.trim($filter, '() ').')'; - $this->labeledURI[] = "{$entry['base']}?{$entry['attr']}?{$scope}?{$filter}"; - } - $this->labeledURI = array_unique($this->labeledURI); - - parent::save(); - $this->cleanup(); - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $ldap->modify($this->attrs); - if(!$ldap->success()){ - msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class())); - } - - if (strcasecmp($this->orig_dn, $this->dn) != 0) - { - $this->renameDNsInDynGroupsValues($this->orig_dn, $this->dn); - } - } - - - /** - * Return attributes values of an LDAP entry. - * @param String $dn DN of the LDAP entry. - * @param Array $attributes Attributes to look for. - * @return Array An associative array of requested values. - */ - public function getAttributesValues ($dn, $attributes = Array('dn')) - { - $ldap = $this->config->get_ldap_link(); - $ldap->cat($dn, $attributes); - if ($attrs = $ldap->fetch()) - { - $data = Array(); - foreach ($attributes as $attribute) - { - if (array_key_exists($attribute, $attrs) !== false) - { - $data[$attribute] = $attrs[$attribute]; - unset($data[$attribute]['count']); - } - } - if (sizeof($data) > 0) - { - return $data; - } - } - return false; - } - - - /** - * Modify search base for all URL of all dynamic groups objects into the LDAP - * directory. - */ - public function renameDNsInDynGroupsValues ($old_dn, $new_dn) - { - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - // - // Build the LDAP search filter. We take only LDAP entries which have all - // objectClasses and attributes defined by this plugin. - // - $filter = ''; - foreach ($this->objectclasses as $objectclass) - { - $filter .= '(objectClass=' . $objectclass . ')'; - } - foreach ($this->attributes as $attribute) - { - $filter .= '(' . $attribute . '=*)'; - } - $filter = '(&' . $filter . ')'; - // - // The search should return some LDAP entries. If so, performed modifications - // on values (delete the values, and add it again with correct search DN). - // - $ldap->search($filter, Array('dn')); - if ($attrs = $ldap->fetch()) - { - foreach ($attrs as $dn) - { - $values = $this->getAttributesValues($dn, $this->attributes); - if ($values === false || !is_array($values)) - { - continue; - } - foreach ($values as $attribute => $value) - { - for($i=0; $icd($dn); - $ldap->modify($values); - } - } - } - - - /** - * Static method to set ACL for this plugin. - */ - public static function plInfo() - { - return Array( - "plShortName" => _("Dynamic object"), - "plDescription" => _("Dynamic object"), - "plSelfModify" => TRUE, - "plDepends" => Array(), - "plPriority" => 1, - "plSection" => Array("addon"), - "plCategory" => Array("groups", "department", "ogroups"), - "plProvidedAcls" => array( - 'labeledURI' => _('labeledURI'), - ) - ); - } -} - -?> diff --git a/gosa-plugins/dyngroup/addons/dyngroup/dyngroup.tpl b/gosa-plugins/dyngroup/addons/dyngroup/dyngroup.tpl deleted file mode 100644 index f3759ca86..000000000 --- a/gosa-plugins/dyngroup/addons/dyngroup/dyngroup.tpl +++ /dev/null @@ -1,30 +0,0 @@ -

{t}List of dynamic rules{/t}

- - - - - - - - - -{foreach item=item key=key from=$labeledURIparsed} - - - - - - - -{/foreach} - - - - -
{t}Base{/t}{t}Scope{/t}{t}Attribute{/t}{t}Filter{/t}
- - - -
diff --git a/gosa-plugins/dyngroup/contrib/README b/gosa-plugins/dyngroup/contrib/README deleted file mode 100644 index 646f1153a..000000000 --- a/gosa-plugins/dyngroup/contrib/README +++ /dev/null @@ -1,100 +0,0 @@ -# ----------------------------------------------------------------------------- # -# README # -# Author(s): Thomas Chemineau - thomas.chemineaugmail.com # -# ----------------------------------------------------------------------------- # - - -1. What this plugin can do ? - - This plugin allow administrator to modify LDAP groups to be populated through - dynamic list feature in OpenLDAP. - - To do that, you have to activate the dynlist overlay in OpenLDAP, and - configure the overlay as decribed bellow. Once the overlay is enabled, member - of a dynamic group will be auto populated. - - This plugin should be configured to appears in groups and departments, under - GOsa. A department could not be a dynamic group, but it can be renamed. This - operation could break LDAP search URLs into dynamic group definition. To - prevent this, this plugin could modify LDAP search URLs when departments and - groups are renamed into the LDAP tree. - - WARNINGS: - Be carefull, GOsa may manage uid into memberUid, and not DN. So, in this - particular case, you can not store DN into memberUid attribute. The main - drawback, in this particular case, is that you can not build LDAP URLs into - dynamic group to search for users directly. The alternative is to look for - memberUid into groups. - - -2. How to activate the dynlist overlay in OpenLDAP ? - - Edit the configuration file (slapd.conf), and put the following lines into - the definition of your database: - - overlay dynlist - dynlist-attrset labeledUriObject labeledURI - - See http://www.openldap.org/doc/admin24/overlays.html#Dynamic%20Lists to have - more informations on dynamic list overlay. - - If your OpenLDAP server loads modules dnamically, you have to load the - dynlist overlay but putting the following lines in the global section of the - configuration files: - - moduleload dynlist - - Finaly, if you do not want GOsa users to modify memberUid values, you could - add an ACL. This ACL will works only if GOsa is connected on your OpenLDAP - server under an application account (and not under the rootdn defined into - the configuration of your LDAP database in slapd.conf): - - # Disable modify on memberUid for all entries which contains - # gosaGroupOfURLs, because these are dynamic, and we do not want users to - # edit the memberUid attribute. - access to filter="objectClass=gosaGroupOfURLs" attrs=memberUid - by * read - - Verify that LDAP schemas of GOsa contains the definition of the objectclass - named "gosaGroupOfURLs". You have two solutions: the first one is to add it - into the schema named gosa-samba3: - - objectclass ( 1.3.6.1.4.1.10098.1.2.1.19.21 - NAME 'gosaGroupOfURLs' - DESC 'Allow a group to be populated through a labeledURI values' - SUP top - AUXILIARY - MAY ( labeledURI ) ) - - The second one, recommended, is to copy the file gosa-dyngroup.schema into - your OpenLDAP schema directory. Then edit slapd.conf and add the inclusion - to this new schema. - - You can now restart your OpenLDAP server :) - - -3. How to enable this feature in GOsa ? - - It is very easy. Edit /etc/gosa/gosa.conf, and add the following line in - the grouptabs section: - - - - Then, add the following line in the deptabs section: - - - - Then, put the plugin in /usr/share/gosa/plugins/addons, and update GOsa cache - via the update-gosa command. - - -4. Known restrictions in OpenLDAP - - You can't search yet on memberUid in a filter: - http://www.openldap.org/lists/openldap-software/200812/msg00030.html - http://www.openldap.org/lists/openldap-software/200901/msg00079.html - - You have to prefer to use the LDAP compare operation: - http://www.openldap.org/lists/openldap-software/200909/msg00073.html - http://www.openldap.org/lists/openldap-software/200909/msg00125.html - diff --git a/gosa-plugins/dyngroup/locale/de/LC_MESSAGES/messages.po b/gosa-plugins/dyngroup/locale/de/LC_MESSAGES/messages.po deleted file mode 100644 index f0ee0a9e1..000000000 --- a/gosa-plugins/dyngroup/locale/de/LC_MESSAGES/messages.po +++ /dev/null @@ -1,52 +0,0 @@ -# translation of messages.po to deutsch -# translation of messages.po to -# GOsa2 Translations -# Copyright (C) 2003 GONICUS GmbH, Germany -# This file is distributed under the same license as the GOsa2 package. -# -# -# Alfred Schroeder , 2004. -# Cajus Pollmeier , 2004, 2005, 2006, 2008, 2009. -# Jan Wenzel , 2004,2005, 2008. -# Stefan Koehler , 2005. -msgid "" -msgstr "" -"Project-Id-Version: messages\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-05-28 18:32+0200\n" -"PO-Revision-Date: 2009-10-05 15:19+0200\n" -"Last-Translator: Cajus Pollmeier \n" -"Language-Team: de \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.0\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:119 -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:121 -msgid "Dynamic Group" -msgstr "" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:204 -#, fuzzy -msgid "dyngroup" -msgstr "Gemeinsame Gruppe" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:205 -#, fuzzy -msgid "Dynamic group setting" -msgstr "Allgemeine Gruppeneinstellungen" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:212 -#, fuzzy -msgid "Dynamic Groups" -msgstr "Gruppen" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:217 -msgid "labeledURI" -msgstr "" - -#: addons/addons/dyngroup/dyngroup.tpl:4 -msgid "Generic" -msgstr "Allgemein" diff --git a/gosa-plugins/dyngroup/locale/fr/LC_MESSAGES/messages.po b/gosa-plugins/dyngroup/locale/fr/LC_MESSAGES/messages.po deleted file mode 100644 index 243c1c14c..000000000 --- a/gosa-plugins/dyngroup/locale/fr/LC_MESSAGES/messages.po +++ /dev/null @@ -1,43 +0,0 @@ -# translation of messages.po to -# Benoit Mortier , 2005, 2006, 2007, 2008, 2009, 2010. -msgid "" -msgstr "" -"Project-Id-Version: messages\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-05-28 18:32+0200\n" -"PO-Revision-Date: 2010-01-28 22:18+0100\n" -"Last-Translator: Benoit Mortier \n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: KBabel 1.11.4\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:119 -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:121 -msgid "Dynamic Group" -msgstr "" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:204 -#, fuzzy -msgid "dyngroup" -msgstr "groupe commun" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:205 -#, fuzzy -msgid "Dynamic group setting" -msgstr "Préférences des groupes génériques" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:212 -#, fuzzy -msgid "Dynamic Groups" -msgstr "Groupes" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:217 -msgid "labeledURI" -msgstr "" - -#: addons/addons/dyngroup/dyngroup.tpl:4 -msgid "Generic" -msgstr "Informations" diff --git a/gosa-plugins/dyngroup/locale/messages.po b/gosa-plugins/dyngroup/locale/messages.po deleted file mode 100644 index 600a282d4..000000000 --- a/gosa-plugins/dyngroup/locale/messages.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-05-28 18:32+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:119 -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:121 -msgid "Dynamic Group" -msgstr "" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:204 -msgid "dyngroup" -msgstr "" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:205 -msgid "Dynamic group setting" -msgstr "" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:212 -msgid "Dynamic Groups" -msgstr "" - -#: addons/addons/dyngroup/classDynamicLdapGroup.inc:217 -msgid "labeledURI" -msgstr "" - -#: addons/addons/dyngroup/dyngroup.tpl:4 -msgid "Generic" -msgstr "" diff --git a/gosa-plugins/dyngroup/plugin.dsc b/gosa-plugins/dyngroup/plugin.dsc deleted file mode 100644 index 9bd952eaf..000000000 --- a/gosa-plugins/dyngroup/plugin.dsc +++ /dev/null @@ -1,8 +0,0 @@ -[gosa-plugin] -name = dyngroup -description = "dynamic group list feature in OpenLDAP" -version = 2.6.7 -author = "Thomas Chemineau - thomas.chemineau@gmail.com" -maintainer = "GOsa packages maintainers group " -homepage = https://oss.gonicus.de/labs/gosa-contrib/ - -- 2.30.2