summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a3081f2)
raw | patch | inline | side by side (parent: a3081f2)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 17 May 2010 12:47:47 +0000 (12:47 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 17 May 2010 12:47:47 +0000 (12:47 +0000) |
-RDN are must values
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18515 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18515 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/fai/admin/fai/class_faiHook.inc b/gosa-plugins/fai/admin/fai/class_faiHook.inc
index c3a43a42eeae420e400e40c55233cd8c422793a0..4fc6ee2a23e1f44f2dc07b0c1f101282d4446a76 100644 (file)
"check" => "gosaProperty::isRdn",
"migrate" => "migrate_faiHookRDN",
"group" => "plugin",
- "mandatory" => FALSE)),
+ "mandatory" => TRUE)),
"plProvidedAcls" => array(
diff --git a/gosa-plugins/fai/admin/fai/class_faiPackage.inc b/gosa-plugins/fai/admin/fai/class_faiPackage.inc
index 7211b599cd31ccb0b180b90bda2b1ca4e19b23ec..8a4744a985e84fb2b78e6386a6bfcd6d7691e8c6 100644 (file)
"check" => "gosaProperty::isRdn",
"migrate" => "migrate_faiPackageRDN",
"group" => "plugin",
- "mandatory" => FALSE)),
+ "mandatory" => TRUE)),
"plProvidedAcls" => array(
"cn" => _("Name"),
diff --git a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc
index 1e01e7aec3c9f7b76bb01d9d5db82a9abd423168..622cc45415b3f2d753a065b4674a3c46613042ca 100644 (file)
"check" => "gosaProperty::isRdn",
"migrate" => "migrate_faiPartitionRDN",
"group" => "plugin",
- "mandatory" => FALSE)),
+ "mandatory" => TRUE)),
"plProvidedAcls" => array(
"cn" => _("Name")." ("._("Read only").")",
diff --git a/gosa-plugins/fai/admin/fai/class_faiProfile.inc b/gosa-plugins/fai/admin/fai/class_faiProfile.inc
index 5f97b2574956bfb4cb0c3ec975c7ed46da181c55..b7d46b1d08bf5b37624be52efab6763192506ab7 100644 (file)
"check" => "gosaProperty::isRdn",
"migrate" => "migrate_faiProfileRDN",
"group" => "plugin",
- "mandatory" => FALSE)),
+ "mandatory" => TRUE)),
"plProvidedAcls" => array(
diff --git a/gosa-plugins/fai/admin/fai/class_faiScript.inc b/gosa-plugins/fai/admin/fai/class_faiScript.inc
index 489f55853a823c288ba0a532807b68b2975d2c42..b944c310e78dddcd766690e7ca25924f41426642 100644 (file)
"check" => "gosaProperty::isRdn",
"migrate" => "migrate_faiScriptRDN",
"group" => "plugin",
- "mandatory" => FALSE
+ "mandatory" => TRUE
)
),
diff --git a/gosa-plugins/fai/admin/fai/class_faiTemplate.inc b/gosa-plugins/fai/admin/fai/class_faiTemplate.inc
index c13bd96cba674cf7e0714e903125f3097ac5b086..2d76c0d00c1a577a7b924ff2b17d3de7fc621a56 100644 (file)
"check" => "gosaProperty::isRdn",
"migrate" => "migrate_faiTemplateRDN",
"group" => "plugin",
- "mandatory" => FALSE)),
+ "mandatory" => TRUE)),
"plProvidedAcls" => array(
"cn" => _("Name")." ("._("Readonly").")",
diff --git a/gosa-plugins/fai/admin/fai/class_faiVariable.inc b/gosa-plugins/fai/admin/fai/class_faiVariable.inc
index fcbf2785c36791eab4a0e859e44585c72977109c..af42beaa8fb5cd83a0f55d3f52d29e6fc999645a 100644 (file)
"check" => "gosaProperty::isRdn",
"migrate" => "migrate_faiVariableRDN",
"group" => "plugin",
- "mandatory" => FALSE)),
+ "mandatory" => TRUE)),
"plProvidedAcls" => array(
"cn" => _("Name")." ("._("Read only").")",
diff --git a/gosa-plugins/fai/admin/fai/migration/class_migrateFaiRDN.inc b/gosa-plugins/fai/admin/fai/migration/class_migrateFaiRDN.inc
index a163bc5875c819e4569be9fc89453e4e12b5eff1..f0e68befd0a12e531c334727505edc96d65976b8 100644 (file)
function checkForIssues()
{
- return(FALSE);
-
// This is very tricky ... have to think about it. Its deactivated currently.
-
$this->found = array();
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$initialValue = $this->prefix.$this->property->getValue().$this->suffix;
$targetValue = $this->prefix.$this->property->getValue(TRUE).$this->suffix;
- $prefixProp = $this->config->configRegistry->getProperty('faiManagement','faiBaseRDN');
- $prefix = $prefixProp->getValue();
- $prefixNew = $prefixProp->getValue(TRUE);
-
$dnMatch = "";
- if(!empty($initialValue) || !empty($prefix)){
- foreach(preg_split("/,/", $initialValue.$prefix) as $rdnPart){
+ if(!empty($initialValue)){
+ foreach(preg_split("/,/", $initialValue) as $rdnPart){
if(empty($rdnPart)) continue;
list($namingAttrs, $container) = preg_split("/=/",$rdnPart,2);
$container = trim($container,', ');
$releases[$attrs['dn']] = $attrs['dn'];
}
+ // Add release bases
+ $faiBase = $this->config->get_cfg_value('faiManagement','faiBaseRDN').$this->config->current['BASE'];
+ $releases[$faiBase] = $faiBase;
+
// Search for users
$filter = sprintf($this->filter,$dnMatch);
$ldap->search($filter,array('dn'));
$found = FALSE;
while($attrs = $ldap->fetch()){
- $dn = $attrs['dn'];
- $dnTo = $dn;
- // Detect the releaes part of the dn.
- $releasePart = $dn;
- while(!isset($releases[$releasePart]) && preg_match("/,/", $releasePart)){
- $releasePart = preg_replace("/^[^,]*+,/","",$releasePart);
+ // Detect release dn
+ $releaseDn = $attrs['dn'];
+ while(!isset($releases[$releaseDn]) && !isset($this->config->idepartments[$releaseDn])){
+ $releaseDn = preg_replace("/^[^,]+,/","",$releaseDn);
}
- if(!isset($releases[$releasePart])){
- // Release not found;
- continue;
+
+ // Build up the new dn
+ $name = preg_replace("/^([^,]*+,).*$/","\\1",$attrs['dn']);
+ $newDn = $name.$targetValue.$releaseDn;
+
+ // Check if we've to create new sub departments
+ if(!$ldap2->dn_exists($targetValue.$releaseDn)){
+ $this->found['add'][$targetValue.$releaseDn] = array();
}
- // Detect the base part of the releasePart
- $basePart = $releasePart;
- while(!isset($this->config->idepartments[$basePart]) && preg_match("/,/", $basePart)){
- $basePart = preg_replace("/^[^,]*+,/","",$basePart);
- }
- if(!isset($this->config->idepartments[$basePart])){
- // Base not found;
- continue;
- }
-
- $releaseRDN = substr($releasePart,0,strlen($releasePart) - strlen($basePart));
-
- // Now remove the faiBaseRDN from the release DN.
- $releaseRDN = preg_replace("/".preg_quote($prefix,'/')."/","", $releaseRDN);
-
- // Remove all parts from the dn to geht the objects name.
- $name = substr($dn,0, (strlen($dn) - strlen($initialValue.$releaseRDN.$prefix.$basePart)));
-
- // Build new container name and check if it exists.
- $newContainer = $targetValue.$releaseRDN.$prefixNew.$basePart;
- if(!$ldap->dn_exists($newContainer)){
- $this->found['add'][$newContainer] = array();
- }
-
- // Check if the target name has changed.
- $dnTo = $name.$newContainer;
- if($dn != $dnTo){
- $this->found['move'][] = array('from' => $dn, 'to' => $dnTo);
+ // Queue object to be moved.
+ if($newDn != $attrs['dn']){
+ $this->found['move'][] = array('from' => $attrs['dn'], 'to' => $newDn);
$found = TRUE;
}
}
return($found);
}
-
- function execute()
- {
- $str = "";
- if(count($this->found['add'])) {
- $str.= "<br><h3>"._("Objects that will be added")."</h3>";
- foreach($this->found['add'] as $dn => $attrs){
- $str.= $dn."<br>";
- }
- }
- if(count($this->found['move'])) {
- $str.= "<br><h3>"._("Objects that will be moved")."</h3>";
- $str.="<pre>";
- foreach($this->found['move'] as $id => $data){
- $checked = (!isset($_POST["migrateNow".get_class($this)])) ? 'checked':'';
- $str.= "<input $checked type='checkbox' value='1' name='migrateEntry_{$id}'>";
- $str.= sprintf(_("Moving object '%s' to '%s'"), $data['from'], $data['to'])."<br>";
- }
- $str.="</pre>";
- }
- $str.= "<button name='migrateNow".get_class($this)."'>"._("Migrate")."</button>";
- return($str);
- }
-
- function save_object()
- {
- if(isset($_POST["migrateNow".get_class($this)])){
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
-
- // Try to add the new container objects
- foreach($this->found['add'] as $dn => $data){
- $ldap->cd($this->config->current['BASE']);
- $ldap->create_missing_trees(ldap::convert($dn));
- }
-
- // Now move the objects to the new traget
- $tmp = new plugin($this->config,NULL);
- foreach($this->found['move'] as $id => $data){
- if(isset($_POST["migrateEntry_{$id}"])){
- $tmp->move($data['from'], $data['to']);
- }
- }
- $this->checkForIssues();
- }
- }
-
- function check()
- {
- return(array());
- }
}