summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d7de6eb)
raw | patch | inline | side by side (parent: d7de6eb)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 2 May 2007 07:00:14 +0000 (07:00 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 2 May 2007 07:00:14 +0000 (07:00 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6219 594d385d-05f5-0310-b6e9-bd551577e9d8
setup/class_setupStep_Migrate.inc | patch | blob | history | |
setup/setup_migrate.tpl | patch | blob | history |
index 949cdbe0378c7620918771f8567bcb02a111f0aa..be6ff373f4c56b54e3af84c288f1266f19caeaa6 100644 (file)
FALSE,
$cv['tls']);
+
+
/* Get winstation ou */
if($cv['generic_settings']['wws_ou_active']) {
$winstation_ou = $cv['generic_settings']['ws_ou'];
}else{
$winstation_ou = "ou=winstations";
}
+
+ if($cv['samba_version'] == 3){
+ $oc = "sambaSamAccount";
+ }else{
+ $oc = "sambaAccount";
+ }
$ldap->cd($cv['base']);
- $res = $ldap->search("(&(objectClass=posixGroup)(sambaGroupType=2)(sambaSID=*))",array("dn","sambaSID"));
+ $res = $ldap->search("(&(objectClass=".$oc.")(uid=*$))",array("dn","sambaSID"));
if(!$res){
$this->checks['outside_winstations']['STATUS'] = FALSE;
$this->checks['outside_winstations']['STATUS_MSG']= _("Ldap query failed.");
$this->outside_winstations = array();
while($attrs = $ldap->fetch()){
- if(preg_match("/-516$/","",$attrs['sambaSID'][0]) && !preg_match("/^[^,]+,".normalizePreg($winstation_ou)."/",$attrs['dn'])){
+ if(!preg_match("/^[^,]+,".normalizePreg($winstation_ou)."/",$attrs['dn'])){
+ $attrs['selected'] = FALSE;
+ $attrs['ldif'] = "";
$this->outside_winstations[base64_encode($attrs['dn'])] = $attrs;
}
}
$this->checks['outside_winstations']['STATUS_MSG']= _("Failed");
$this->checks['outside_winstations']['ERROR_MSG'] =
sprintf(_("Found %s winstations outside the predefined winstation department ou '%s'."),count($this->outside_winstations),$winstation_ou);
+ $this->checks['outside_winstations']['ERROR_MSG'].= "<input type='submit' name='outside_winstations_dialog' value='"._("Migrate")."'>";
return(false);
}else{
$this->checks['outside_winstations']['STATUS'] = TRUE;
$cv['tls']);
$people_ou = $cv['peopleou'];
$ldap->cd($cv['base']);
- $res = $ldap->search("(objectClass=gosaAccount)",array("dn"));
+ $res = $ldap->search("(&(objectClass=gosaAccount)(!(uid=*$)))",array("dn"));
if(!$res){
$this->checks['outside_users']['STATUS'] = FALSE;
$this->checks['outside_users']['STATUS_MSG']= _("Ldap query failed.");
}
+ function migrate_outside_winstations($perform = FALSE)
+ {
+ /* Establish ldap connection */
+ $cv = $this->parent->captured_values;
+ $ldap = new LDAP($cv['admin'],
+ $cv['password'],
+ $cv['connection'],
+ FALSE,
+ $cv['tls']);
+
+ $ldap->cd($cv['base']);
+
+ /* Check if there was a destination department posted */
+ if(isset($_POST['move_winstation_to'])){
+ $destination_dep = $_POST['move_winstation_to'];
+ }else{
+ print_red(_("Couldn't move users to specified department."));
+ return(false);
+ }
+
+ foreach($this->outside_winstations as $b_dn => $data){
+ $this->outside_winstations[$b_dn]['ldif'] ="";
+ if($data['selected']){
+ $dn = base64_decode($b_dn);
+ $d_dn = preg_replace("/,.*$/",",".base64_decode($destination_dep),$dn);
+ if(!$perform){
+ $this->outside_winstations[$b_dn]['ldif'] = _("Winstation will be moved from").":<br>\t".$dn."<br>"._("to").":<br>\t".$d_dn;
+
+
+ /* Check if there are references to this object */
+ $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
+ $refs = "";
+ while($attrs = $ldap->fetch()){
+ $ref_dn = $attrs['dn'];
+ $refs .= "<br />\t".$ref_dn;
+ }
+ if(!empty($refs)){
+ $this->outside_winstations[$b_dn]['ldif'] .= "<br /><br /><i>"._("Updating following references too").":</i>".$refs;
+ }
+
+ }else{
+ $this->move($dn,$d_dn);
+ }
+ }
+ }
+ }
+
+
function migrate_outside_groups($perform = FALSE)
{
/* Establish ldap connection */
$this->checks_initialised = TRUE;
}
+ /*************
+ * Winstations outside the group ou
+ *************/
+
+ if(isset($_POST['outside_winstations_dialog_cancel'])){
+ $this->outside_winstations_dialog = FALSE;
+ $this->dialog = FALSE;
+ }
+
+ if(isset($_POST['outside_winstations_dialog_whats_done'])){
+ $this->migrate_outside_winstations(FALSE);
+ }
+
+ if(isset($_POST['outside_winstations_dialog_perform'])){
+ $this->migrate_outside_winstations(TRUE);
+ $this->search_outside_winstations();
+ }
+
+ if(isset($_POST['outside_winstations_dialog'])){
+ $this->outside_winstations_dialog = TRUE;
+ $this->dialog = TRUE;
+ }
+
+ if($this->outside_winstations_dialog){
+ $smarty = get_smarty();
+ $smarty->assign("ous",$this->get_all_winstation_ous());
+ $smarty->assign("method","outside_winstations");
+ $smarty->assign("outside_winstations",$this->outside_winstations);
+ return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+ }
/*************
* Groups outside the group ou
*************/
function save_object()
{
+ /* Capture all selected winstations from outside_winstations_dialog */
+ if($this->outside_winstations_dialog){
+ foreach($this->outside_winstations as $dn => $data){
+ if(isset($_POST['select_winstation_'.$dn])){
+ $this->outside_winstations[$dn]['selected'] = TRUE;
+ }else{
+ $this->outside_winstations[$dn]['selected'] = FALSE;
+ }
+ }
+ }
+
/* Capture all selected groups from outside_groups_dialog */
if($this->outside_groups_dialog){
foreach($this->outside_groups as $dn => $data){
return($tmp);
}
+ function get_all_winstation_ous()
+ {
+ /* Get collected configuration settings */
+ $cv = $this->parent->captured_values;
+
+ /* Establish ldap connection */
+ $ldap = new LDAP($cv['admin'],
+ $cv['password'],
+ $cv['connection'],
+ FALSE,
+ $cv['tls']);
+
+ /* Get winstation ou */
+ if($cv['generic_settings']['wws_ou_active']) {
+ $winstation_ou = $cv['generic_settings']['ws_ou'];
+ }else{
+ $winstation_ou = "ou=winstations";
+ }
+
+ $ldap->cd($cv['base']);
+ $ldap->search("(".$winstation_ou.")",array("dn"));
+
+ if($ldap->count() == 0 ){
+ $add_dn = $cv['groupou'].",".$cv['base'];
+ $naming_attr = preg_replace("/=.*$/","",$add_dn);
+ $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
+ $add = array();
+ $add['objectClass'] = array("organizationalUnit");
+ $add[$naming_attr] = $naming_value;
+
+ $ldap->cd($cv['base']);
+ $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
+ $ldap->cd($add_dn);
+ $ldap->add($add);
+ }
+
+ $ldap->search("(".$winstation_ou.")",array("dn"));
+ $tmp = array();
+ while($attrs= $ldap->fetch()){
+ if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
+ $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
+ }
+ }
+ return($tmp);
+ }
+
+
function get_all_group_ous()
{
index b726897c54992c914d1d4015e8638ba99d480660..cbf5a8ee06d1cf2d310cd5802418f91a8f70eea8 100644 (file)
--- a/setup/setup_migrate.tpl
+++ b/setup/setup_migrate.tpl
<div> </div>
{/foreach}
+ {elseif $method == "outside_winstations"}
+
+ <h2>{t}Move windows workstations into a valid windows workstation department{/t}</h2>
+
+ {t}This dialog allows you to move the displayed windows workstations into a valid department{/t}
+ <br>
+ {t}Be careful with this tool, there may be references pointing to this workstations that can't be migrated.{/t}
+ <br>
+ <br>
+
+ {foreach from=$outside_winstations item=val key=key}
+ {if $outside_winstations.$key.selected}
+ <input type='checkbox' name='select_winstation_{$key}' checked>
+ {else}
+ <input type='checkbox' name='select_winstation_{$key}'>
+ {/if}
+
+ {$outside_winstations.$key.dn}
+ {if $outside_winstations.$key.ldif != ""}
+ <div class="step2_entry_container_info" id="sol_8">
+<div style='padding-left:20px;'>
+<pre>
+{$outside_winstations.$key.ldif}
+</pre>
+</div>
+</div>
+ {/if}
+ <br>
+ {/foreach}
+
+ <p>
+ <b>{t}Move selected windows workstations into the following GOsa department{/t} : </b>
+ <select name='move_winstation_to'>
+ {html_options options=$ous}
+ </select>
+ <br>
+ <input type='submit' name='outside_winstations_dialog_perform' value='{t}Move selected workstations{/t}'>
+ <input type='submit' name='outside_winstations_dialog_whats_done' value='{t}What will be done here{/t}'>
+ </p>
+
+
+ <p class='seperator'> </p>
+ <div style='width:100%; text-align:right; padding:5px;'>
+ <input type='submit' name='outside_winstations_dialog_cancel' value='{t}Close{/t}'>
+ </div>
+
+
{elseif $method == "outside_groups"}
<h2>{t}Move groups into valid group departments{/t}</h2>