diff --git a/gosa-core/setup/class_setupStep_Migrate.inc b/gosa-core/setup/class_setupStep_Migrate.inc
index d6b486930b911baa287c807874b143347d34bf98..9de097644c1a9d0bb6c1eb4940a77f1c7b0346be 100644 (file)
{
var $languages = array();
var $attributes = array();
- var $header_image = "images/monitoring.png";
+ var $header_image = "images/setup/migrate.png";
var $checks = array();
/* Department migration attributes */
$this->checks['permissions']['STATUS'] = FALSE;
$this->checks['permissions']['STATUS_MSG']= "";
$this->checks['permissions']['ERROR_MSG'] = "";
-// $this->check_ldap_permissions();
+ $this->check_ldap_permissions();
$this->checks['deps_visible']['TITLE'] = _("Checking for invisible departments");
$this->checks['deps_visible']['STATUS'] = FALSE;
$this->checks['deps_visible']['STATUS_MSG']= "";
-// $this->checks['deps_visible']['ERROR_MSG'] = "";
+ $this->checks['deps_visible']['ERROR_MSG'] = "";
$this->checks['users_visible']['TITLE'] = _("Checking for invisible users");
$this->checks['users_visible']['STATUS'] = FALSE;
$this->checks['users_visible']['STATUS_MSG']= "";
$this->checks['users_visible']['ERROR_MSG'] = "";
-// $this->check_gosaAccounts();
+ $this->check_gosaAccounts();
$this->checks['acls']['TITLE'] = _("Checking for super administrator");
$this->checks['acls']['STATUS'] = FALSE;
$this->checks['acls']['STATUS_MSG']= "";
$this->checks['acls']['ERROR_MSG'] = "";
-// $this->check_administrativeAccount();
+ $this->check_administrativeAccount();
$this->checks['outside_users']['TITLE'] = _("Checking for users outside the people tree");
$this->checks['outside_users']['STATUS'] = FALSE;
$this->checks['outside_users']['STATUS_MSG']= "";
$this->checks['outside_users']['ERROR_MSG'] = "";
-// $this->search_outside_users();
+ $this->search_outside_users();
$this->checks['outside_groups']['TITLE'] = _("Checking for groups outside the groups tree");
$this->checks['outside_groups']['STATUS'] = FALSE;
$this->checks['outside_groups']['STATUS_MSG']= "";
$this->checks['outside_groups']['ERROR_MSG'] = "";
-// $this->search_outside_groups();
-// $this->check_organizationalUnits();
+ $this->search_outside_groups();
+ $this->check_organizationalUnits();
$this->checks['outside_winstations']['TITLE'] = _("Checking for windows workstations outside the winstation tree");
$this->checks['outside_winstations']['STATUS'] = FALSE;
$this->checks['outside_winstations']['STATUS_MSG']= "";
$this->checks['outside_winstations']['ERROR_MSG'] = "";
-// $this->search_outside_winstations();
+ $this->search_outside_winstations();
$this->checks['uidNumber_usage']['TITLE'] = _("Checking for duplicated UID numbers");
$this->checks['uidNumber_usage']['STATUS'] = FALSE;
$this->checks['uidNumber_usage']['STATUS_MSG']= "";
$this->checks['uidNumber_usage']['ERROR_MSG'] = "";
-// $this->check_uidNumber();
+ $this->check_uidNumber();
$this->checks['gidNumber_usage']['TITLE'] = _("Checking for duplicate GID numbers");
$this->checks['gidNumber_usage']['STATUS'] = FALSE;
$this->checks['gidNumber_usage']['STATUS_MSG']= "";
$this->checks['gidNumber_usage']['ERROR_MSG'] = "";
-// $this->check_gidNumber();
+ $this->check_gidNumber();
$this->checks['old_style_devices']['TITLE'] = _("Checking for old style USB devices");
$this->checks['old_style_devices']['STATUS'] = FALSE;
$this->checks['old_style_devices']['STATUS_MSG']= "";
$this->checks['old_style_devices']['ERROR_MSG'] = "";
-// $this->check_usb_devices();
+ $this->check_usb_devices();
$this->checks['old_style_services']['TITLE'] = _("Checking for old services that have to be migrated");
$this->checks['old_style_services']['STATUS'] = FALSE;
$this->checks['old_style_services']['STATUS_MSG']= "";
$this->checks['old_style_services']['ERROR_MSG'] = "";
-// $this->check_services();
+ $this->check_services();
$this->checks['old_style_menus']['TITLE'] = _("Checking for old style application menus");
$this->checks['old_style_menus']['STATUS'] = FALSE;
/* Get winstation ou */
if($cv['generic_settings']['wws_ou_active']) {
- $winstation_ou = $cv['generic_settings']['ws_ou'];
+ $winstation_ou = $cv['generic_settings']['wws_ou'];
}else{
$winstation_ou = "ou=winstations";
}
{
$pw1 = $pw2 = "";
$uid = "";
+
+ /* On first call check for rid/sid base */
+ $cv = $this->parent->captured_values;
+ $ldap_l = new LDAP($cv['admin'],
+ $cv['password'],
+ $cv['connection'],
+ FALSE,
+ $cv['tls']);
+
+ $ldap = new ldapMultiplexer($ldap_l);
if(isset($_POST['new_user_uid'])){
$uid = $_POST['new_user_uid'];
$pw2 = $_POST['new_user_password2'];
}
+
+ $ldap->cd($cv['base']);
+ $ldap->search("(uid=".$uid.")");
+ if($ldap->count()){
+ msg_dialog::display(_("Input error"),msgPool::duplicated(_("Uid")), ERROR_DIALOG);
+ return false;
+ }
+
if(empty($pw1) || empty($pw2) | ($pw1 != $pw2)){
msg_dialog::display(_("Password error"), _("Provided passwords do not match!"), ERROR_DIALOG);
return false;
msg_dialog::display(_("Input error"), _("Specify a valid user ID!"), ERROR_DIALOG);
return false;
}
-
- /* On first call check for rid/sid base */
- $cv = $this->parent->captured_values;
- $ldap_l = new LDAP($cv['admin'],
- $cv['password'],
- $cv['connection'],
- FALSE,
- $cv['tls']);
-
- $ldap = new ldapMultiplexer($ldap_l);
-
+
+
/* Get current base attributes */
$ldap->cd($cv['base']);
}
if(isset($_POST['migrate_services'])){
- $this->migrate_usb_services();
+ $this->migrate_services();
# $this->dialog = FALSE;
# $this->show_details = FALSE;
# $this->service_dialog = FALSE;
}
if(isset($_POST['migrate_menus'])){
- $this->migrate_usb_menus();
+ $this->migrate_menus();
# $this->dialog = FALSE;
# $this->show_details = FALSE;
# $this->menu_dialog = FALSE;
/* Get winstation ou */
if($cv['generic_settings']['wws_ou_active']) {
- $winstation_ou = $cv['generic_settings']['ws_ou'];
+ $winstation_ou = $cv['generic_settings']['wws_ou'];
}else{
$winstation_ou = "ou=winstations";
}
}
+ /*! \brief Act in posts from the device migration dialog
+ */
function check_device_posts()
{
foreach($this->device as $key => $device){
}
+ /*! \brief Check for old style (gosa-2.5) devices.
+ Save readable informations and a list of migratable devices
+ in $this->devices.
+ */
function check_usb_devices ()
{
/* Establish ldap connection */
}
$this->checks['old_style_devices']['STATUS'] = FALSE;
- $this->checks['old_style_devices']['STATUS_MSG']= _("Failed");
+ $this->checks['old_style_devices']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
$this->checks['old_style_devices']['ERROR_MSG'] =
sprintf(_("There are %s devices that need to be migrated."),count($this->device)).
"<input type='submit' name='device_dialog' value='"._("Migrate")."'>";
}
}
+
+ /*! \brief Migrate all selected devices.
+ Execute all required ldap actions to migrate the
+ selected devices.
+ */
function migrate_usb_devices ()
{
/* Establish ldap connection */
$ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$newdn));
$ldap->cd($newdn);
$ldap->add($new_attr);
+
+ /* Throw an error message if the action failed.
+ */
if(!$ldap->success()){
msg_dialog::display(_("LDAP error"),
- sprintf(_("Ldap add failed for %s with error %s"),
+ sprintf(_("Adding '%s' to the LDAP failed: %s"),
"<b>".LDAP::fix($newdn)."</b>",
"<br><br><i>".$ldap->get_error()."</i>"), ERROR_DIALOG);
}else{
+
+ /* Remove old style device definition from source object.
+ */
$update['gotoHotplugDevice'] = array();
for($i = 0 ; $i < $attrs['gotoHotplugDevice']['count'] ; $i++){
if($attrs['gotoHotplugDevice'][$i] == $device['OLD_DEVICE']){
$ldap->cat($device['DN'],array("gotoHotplugDevice"));
if(!$ldap->success()){
msg_dialog::display(_("LDAP error"),
- sprintf(_("Ldap update failed for %s with error %s"),
+ sprintf(_("Updating '%s' failed: %s"),
"<b>".LDAP::fix($device['DN'])."</b>",
"<br><br><i>".$ldap->get_error()."</b>"), ERROR_DIALOG);
}else{
}
}
}
+ $this->check_usb_devices();
}
-
+ /*! \brief Check for old style (gosa-2.5) services that have to be migrated
+ to be useable in gosa-2.6.
+ All required changes are stored in $this->service, also some
+ readable informations describing the actions required
+ to migrate the service
+ */
function check_services()
{
/* Establish ldap connection */
*/
if(count($this->service)){
$this->checks['old_style_services']['STATUS'] = FALSE;
- $this->checks['old_style_services']['STATUS_MSG']= _("Failed");
+ $this->checks['old_style_services']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
$this->checks['old_style_services']['ERROR_MSG'] =
sprintf(_("There are %s services that need to be migrated."),
count($this->service)).
}
- function migrate_usb_services()
+
+ /*! \brief Migrate selected services.
+ This function executes the commands collected by the
+ service_check() function.
+ */
+ function migrate_services()
{
/* Establish ldap connection
*/
*/
if(!$ldap->success()){
msg_dialog::display(_("LDAP error"),
- sprintf(_("Ldap update failed for %s with error %s"),
+ sprintf(_("Updating '%s' failed: %s"),
"<b>".LDAP::fix($service['DN'])."</b>",
"<br><br><i>".$ldap->get_error()."</b>"), ERROR_DIALOG);
}else{
}
}
}
+
+ /* Update the service migration status
+ */
+ $this->check_services();
}
+ /*! \brief Ensure that posts made on the service migration dialog
+ are processed.
+ */
function check_service_posts()
{
foreach($this->service as $key => $service){
which configured parameter belongs to which application entry.
*/
$amap= array();
+ $todo = array();
$ldap->cd($cv['base']);
$ldap->search("(objectClass=gosaApplication)", array("cn", "gosaApplicationParameter"));
while($info = $ldap->fetch()){
/* Create readable prefix for "What will be done" infos
*/
- $s_add = "<i>"._("add")."</i>\t";
- $s_del = "<i>"._("remove")."</i>\t";
+ $s_add = "<i>"._("Add")."</i>\t";
+ $s_del = "<i>"._("Remove")."</i>\t";
/* Walk through all found old-style menu configurations.
-Prepare ldap update list $data
if(count($this->menu)){
$this->checks['old_style_menus']['STATUS'] = FALSE;
$this->checks['old_style_menus']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
- $this->checks['old_style_menus']['ERROR_MSG'] = sprintf(_("There are %s application menus which have to be converted."),
+ $this->checks['old_style_menus']['ERROR_MSG'] = sprintf(_("There are %s application menus which have to be migrated."),
count($this->menu))."<input type='submit' name='menu_dialog' value='"._("Migrate")."'>";
}else{
$this->checks['old_style_menus']['STATUS'] = TRUE;
All selected menus will be converted (DETAILS = TRUE).
The ldap actions collected by check_menus() will be executed.
*/
- function migrate_usb_menus()
+ function migrate_menus()
{
/* Establish ldap connection
$success = TRUE;
foreach($menu['TODO']['ADD'] as $dn => $data){
$ldap->cd($cv['base']);
- $base = preg_replace("/^[^,]+,/","",$dn);
if(!$ldap->dn_exists($dn)){
$ldap->cd($dn);
$ldap->add($data);
*/
foreach($menu['TODO']['MODIFY'] as $dn => $data){
$ldap->cd($cv['base']);
- if(!$ldap->dn_exists($dn)){
+ if($ldap->dn_exists($dn)){
$ldap->cd($dn);
$ldap->modify($data);
if (!$ldap->success()){