From a54b715de45278bac173e8822aae4a509a8d5774 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 5 Mar 2008 07:23:21 +0000 Subject: [PATCH] Updated setup -Added additional information if schema check fails. The check also fails with correct ACLs while the database wasn't initialized yet. (BASE object missing-migration step) git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9332 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/setup/class_setupStep_Schema.inc | 25 +++++++++++++++-- gosa-core/setup/setup_schema.tpl | 32 +++++++++++++++------- 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/gosa-core/setup/class_setupStep_Schema.inc b/gosa-core/setup/class_setupStep_Schema.inc index ebf083a45..63b6ce473 100644 --- a/gosa-core/setup/class_setupStep_Schema.inc +++ b/gosa-core/setup/class_setupStep_Schema.inc @@ -29,6 +29,8 @@ class Step_Schema extends setup_step var $enable_schema_check = TRUE; var $samba_version = 3; + var $found_ocs = 0; + function Step_Schema() { $this->update_strings(); @@ -58,9 +60,28 @@ class Step_Schema extends setup_step }else{ $this->is_completed = TRUE; } + + /* Check if the database is already initialised. + * If the root object is missing we can't read any schema informations. + * In this case we should display a message. + */ + $cv = $this->parent->captured_values; + + /* Establish ldap connection */ + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + /* Check if root object exists */ + $ldap->cd($cv['base']); + $res = $ldap->search("(objectClass=*)"); $smarty = get_smarty(); $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes"))); + $smarty->assign("database_initialised", ($res == TRUE)); + $smarty->assign("found_ocs", $this->found_ocs); $smarty->assign("schema_readable",$this->schema_readable); $smarty->assign("enable_schema_check",$this->enable_schema_check); $smarty->assign("checks",$this->checked); @@ -91,9 +112,7 @@ class Step_Schema extends setup_step /* Get objectclasses */ $ldap = new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE,$cfg['tls']); $objectclasses = $ldap->get_objectclasses(); - if(count($objectclasses) == 0){ - msg_dialog::display(_("LDAP error"), _("Cannot detect information about the installed LDAP schema!"), ERROR_DIALOG); - } + $this->found_ocs = count($objectclasses); /* Which samba version do we use? */ if(isset($objectclasses['sambaSamAccount'])){ diff --git a/gosa-core/setup/setup_schema.tpl b/gosa-core/setup/setup_schema.tpl index e56538b1e..908b989b7 100644 --- a/gosa-core/setup/setup_schema.tpl +++ b/gosa-core/setup/setup_schema.tpl @@ -21,20 +21,32 @@ {else} {t}Schema check failed{/t} + + {/if}
- {foreach from=$checks item=val key=key} - {if !$checks[$key].STATUS} -
- {if $checks[$key].IS_MUST_HAVE} - {$checks[$key].MSG} - {else} - {$checks[$key].MSG} + + {if $found_ocs == 0} + {t}Could not read any schema informations, all checks skipped. Adjust your ldap acls.{/t} +
+ {if !$database_initialised} +
+ {t}It seems that your ldap database wasn't initialized yet. This maybe the reason, why GOsa can't read your schema configuration!{/t} + {/if} + {else} + {foreach from=$checks item=val key=key} + {if !$checks[$key].STATUS} +
+ {if $checks[$key].IS_MUST_HAVE} + {$checks[$key].MSG} + {else} + {$checks[$key].MSG} + {/if} +
{/if} -
- {/if} - {/foreach} + {/foreach} + {/if}
-- 2.30.2