Commit 43fb61a1 authored by Côme Bernigaud's avatar Côme Bernigaud
Browse files

Fixes #2919 Removed schema check step

Conflicts:
	setup/class_setupStep_Schema.inc
	setup/setup_schema.tpl
parent 06b77759
......@@ -22,7 +22,3 @@ display:none;
div.setup_menu {
display:none;
}
div.setup_bottom {
display:none;
}
......@@ -8,38 +8,6 @@ padding:4px 5px;
border-bottom:1px solid #B0B0B0;
}
/* Setup footer */
div.setup_bottom {
clear:left;
background-color:#DDD;
border-top:solid 1px red;
}
html.rtl div.setup_bottom {
clear:right;
}
/* Header col */
div.setup_plug_header {
padding:10px;
border-bottom:solid 1px #D0D0D0;
background-color:#E0E0F0;
border:10px solid #FFF;
}
/* Content col */
div.setup_contents {
margin-right:2px;
margin-left:20%;
background-color:#FFF;
width:80%;
border:1px solid #AAA;
padding:2px;
}
html.rtl div.setup_contents {
margin-right:20%;
margin-left:2px;
}
/* default.*/
div.default {
padding:2px 10px;
......@@ -50,17 +18,6 @@ vertical-align:middle;
width:200px;
}
/* Navigation title */
div.setup_navigation_title {
font-size:1.2em;
font-weight:bold;
text-decoration:none;
width:100%;
padding-top:8px;
padding-bottom:8px;
border-top:1px solid #AAA;
}
/* The box used for each setup step */
#menucell.setup_navigation li.menuitem {
text-decoration:none;
......@@ -131,14 +88,6 @@ html.rtl div.solution_visible {
text-align:right;
}
/* Container headline */
h2.step2_container_title {
background-color:#F0F0F0;
border:solid 1px #CCC;
width:100%;
padding:3px;
}
/* Container for name and status */
div.step2_entry_container {
padding:3px;
......@@ -213,35 +162,3 @@ padding-left:25px;
html.rtl div.step2_warning_text {
padding-right:25px;
}
/*
Setup step 4 styles
*/
li.step4_name,div.step4_name {
width:33%;
height:2em;
}
html.ltr li.step4_name, html.ltr div.step4_name {
float:left;
}
html.rtl li.step4_name, html.rtl div.step4_name {
float:right;
}
li.step4_value,div.step4_value {
width:50%;
height:2em;
}
html.ltr li.step4_value, html.ltr div.step4_value {
float:left;
}
html.rtl li.step4_value, html.rtl div.step4_value {
float:right;
}
ul.step4_container,div.step4_container {
height:2em;
margin-top:2px;
margin-left:2px;
margin-right:2px;
}
......@@ -2733,7 +2733,6 @@ function check_schema($cfg, $rfc2307bis = FALSE)
}
foreach ($checks as $name => $value) {
foreach ($value['CLASSES_REQUIRED'] as $class) {
if (!isset($objectclasses[$name])) {
if ($value['IS_MUST_HAVE']) {
$checks[$name]['STATUS'] = FALSE;
......@@ -2766,7 +2765,7 @@ function check_schema($cfg, $rfc2307bis = FALSE)
$checks['posixGroup']['INFO'] = "";
/* Depending on selected rfc2307bis mode, we need different schema configurations */
if (isset($tmp['posixGroup'])) {
if (isset($tmp['posixGroup']) && is_bool($rfc2307bis)) {
if ($rfc2307bis && isset($tmp['posixGroup']['STRUCTURAL'])) {
$checks['posixGroup']['STATUS'] = FALSE;
$checks['posixGroup']['MSG'] = _("You have enabled the rfc2307bis option on the 'ldap setup' step, but your schema configuration do not support this option.");
......
......@@ -114,7 +114,7 @@ class configInLdap extends simplePlugin
_('Schema validation'),
_('Enables schema checking during login.'),
'fdSchemaCheck', FALSE,
FALSE
TRUE
),
)
),
......
......@@ -28,7 +28,7 @@ class setup
var $i_steps; // Number of setup steps
var $i_current = 0; // Current step
var $i_previous = 0; // Previous setup step;
var $i_config = 5;
var $i_config = 4;
var $o_steps = array();
var $captured_values = array();
......@@ -39,7 +39,6 @@ class setup
new Step_Language(),
new Step_Checks(),
new Step_Ldap(),
new Step_Schema(),
new Step_Config_before_init(),
new Step_Migrate(),
new Step_Finish(),
......
......@@ -52,9 +52,7 @@ class Step_Config extends configInLdap
global $config;
parent::__construct($config, CONFIGRDN.$config->current['BASE']);
$this->fdRfc2307bis = $cv['rfc2307bis'];
$this->fdLanguage = $cv['lang_selected'];
$this->fdSchemaCheck = $cv['enable_schema_check'];
}
function update_strings()
......
......@@ -79,15 +79,6 @@ class Step_Ldap extends setupStep
),
)
),
'schema' => array(
'name' => _('Schema settings'),
'attrs' => array(
new BooleanAttribute(
_('Use rfc2307bis compliant groups'), _('Enables rfc2307bis style groups. You can use "member" attributes instead of "memberUid" with this schema.'),
'rfc2307bis', FALSE
),
)
),
'status' => array(
'name' => _('Status'),
'attrs' => array(
......@@ -185,5 +176,25 @@ class Step_Ldap extends setupStep
}
}
}
function check()
{
$error = parent::check();
if (!empty($error)) {
return $error;
} elseif ($this->is_completed) {
$checked = check_schema($this->parent->captured_values, "NO RFC CHECK");
$error = array();
foreach ($this->checked as $check) {
if (!$check['STATUS']) {
$error[] = $check['MSG'];
}
}
if (!empty($error)) {
$this->is_completed = FALSE;
}
return $error;
}
}
}
?>
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2007 Fabian Hickert
Copyright (C) 2011-2015 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Step_Schema extends setup_step
{
var $checked = array();
var $not_checked = array();
var $schema_readable = FALSE;
var $attributes = array("enable_schema_check","samba_version");
var $enable_schema_check = TRUE;
var $samba_version = 3;
var $header_image = 'geticon.php?context=types&icon=user&size=48';
var $found_ocs = 0;
function __construct()
{
$this->update_strings();
}
function update_strings()
{
$this->s_title = _("LDAP schema check");
$this->s_title_long = _("LDAP schema check");
$this->s_info = _("Perform test on your current LDAP schema");
}
function execute()
{
global $BASE_DIR;
$this->check_schema();
$failed_checks = 0;
foreach ($this->checked as $val) {
if (!$val['STATUS']) {
$failed_checks ++;
}
}
if ($failed_checks == 0) {
$this->is_completed = TRUE;
} 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.
*/
/* Establish ldap connection */
$cv = $this->parent->captured_values;
$ldap = $this->get_ldap_link();
/* Check if root object exists */
$ldap->cd($cv['base']);
$ldap->set_size_limit(1);
$res = $ldap->search("(objectClass=*)");
$ldap->set_size_limit(0);
$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);
$smarty->assign("not_checked", $this->not_checked);
$smarty->assign("failed_checks", $failed_checks);
return $smarty->fetch("$BASE_DIR/setup/setup_schema.tpl");
}
function save_object()
{
if (isset($_POST['step7_posted'])) {
/* Get attributes */
foreach ($this->attributes as $attr) {
if (isset($_POST[$attr])) {
$this->$attr = validate($_POST[$attr]);
}
}
}
}
function check_schema()
{
$cfg = $this->parent->captured_values;
/* Get objectclasses */
$ldap = new LDAP($cfg['admin'], $cfg['password'], $cfg['connection'], FALSE, $cfg['tls']);
$objectclasses = $ldap->get_objectclasses(TRUE);
$this->found_ocs = count($objectclasses);
$rfc2307bis = $cfg['rfc2307bis'];
$this->checked = check_schema($cfg, $rfc2307bis);
/* Which samba version do we use? */
if (isset($objectclasses['sambaSamAccount'])) {
$this->samba_version = 3;
} elseif (isset($objectclasses['sambaAccount'])) {
$this->samba_version = 2;
} else {
$this->samba_version = 0;
}
}
}
?>
<div class='default'>
<p>
<b>{t}Schema specific settings{/t}</b>
</p>
<div class='step4_container'>
<div class='step4_name' style='width:30%'>
{t}Enable schema validation when logging in{/t}
</div>
<div class='step4_value'>
<select name='enable_schema_check'>
{html_options options=$bool selected=$enable_schema_check}
</select>
</div>
</div>
<p>
<b>{t}Check status{/t}</b>
</p>
<div>
{if $failed_checks == 0}
<div style="color:green">{t}Schema check succeeded{/t}</div>
{else}
<img src="geticon.php?context=status&icon=dialog-warning&size=16" class="center">
<div style="color:red">{t}Schema check failed{/t}</div>
{/if}
</div>
<div style="margin-left:20px;">
{if $found_ocs == 0}
<b>{t}Could not read any schema informations, all checks skipped. Adjust your ldap acls.{/t}</b>
<br>
{if !$database_initialised}
<br>
{t}It seems that your ldap database wasn't initialized yet. This might be the reason why FusionDirectory can't read your schema configuration!{/t}
{/if}
{else}
{foreach from=$checks item=val key=key}
{if !$checks[$key].STATUS}
<br>
{if $checks[$key].IS_MUST_HAVE}
<div style='color:red'>{$checks[$key].MSG}</div>
{else}
{$checks[$key].MSG}
{/if}
<br>
{/if}
{/foreach}
{/if}
</div>
</div>
<input type='hidden' value='1' name='step7_posted'>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment