Commit 808d1a52 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #4136 Removing core dependency to samba schema

parent 4ca91159
......@@ -79,11 +79,11 @@ class dashboardUsers extends simplePlugin
}
}
}
$ldap->search("(&(objectClass=inetOrgPerson)(objectClass=gosaMailAccount))", array("cn"));
$ldap->search('(&(objectClass=inetOrgPerson)(objectClass=gosaMailAccount))', array('cn'));
$nb_mail_accounts = $ldap->count();
$ldap->search("(&(objectClass=inetOrgPerson)(objectClass=posixAccount))", array("cn"));
$ldap->search('(&(objectClass=inetOrgPerson)(objectClass=posixAccount))', array('cn'));
$nb_posix_accounts = $ldap->count();
$ldap->search("(&(objectClass=inetOrgPerson)(objectClass=sambaSamAccount))", array("cn"));
$ldap->search('(&(objectClass=inetOrgPerson)(objectClass=sambaSamAccount))', array('cn'));
$nb_samba_accounts = $ldap->count();
return array(
......@@ -136,8 +136,10 @@ class dashboardUsers extends simplePlugin
/* search all account with all date, mail, telephone */
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$ldap->search('(&(|(objectClass=posixAccount)(objectClass=sambaSamAccount))(shadowExpire=*))',
array('uid','shadowExpire','mail','telephoneNumber','cn','manager'));
$ldap->search(
'(shadowExpire=*)',
array('uid','shadowExpire','mail','telephoneNumber','cn','manager')
);
$expired_accounts = array();
$next_expired_accounts = array();
......
......@@ -123,12 +123,16 @@ class groupManagement extends simpleManagement
$filters = array(
array('id' => 'USER', 'label' => _('Show user groups')),
array('id' => 'PRIMARY', 'label' => _('Show primary groups')),
array('id' => 'SAMBA', 'label' => _('Show samba groups')),
array('id' => 'MAIL', 'label' => _('Show mail groups')),
array('id' => 'ROLE', 'label' => _('Show organizational roles')),
array('id' => 'APPLICATION', 'label' => _('Show application groups')),
array('id' => 'DEPARTMENT', 'label' => _('Show department groups')),
);
if (class_available('mailAccount')) {
$filters[]= array('id' => 'MAIL', 'label' => _('Show mail groups'));
}
if (class_available('sambaAccount')) {
$filters[]= array('id' => 'SAMBA', 'label' => _('Show samba groups'));
}
if (class_available('systemManagement')) {
$filters = array_merge(
$filters,
......
......@@ -79,19 +79,30 @@ class userManagement extends simpleManagement
{
parent::configureFilter();
if (!class_available('mailAccount')) {
$classes = array('posixAccount')
if (class_available('mailAccount')) {
$classes[]= 'gosaMailAccount';
} else {
/* If mail plugin is not installed, ignore mail filter */
$this->filter->elements['MAIL']['unset'] = '';
$this->filter->elements['MAIL']['set'] = '';
/* The FUNCTIONAL filter must not use inexisting gosaMailAccount class */
$this->filter->elements['FUNCTIONAL']['set'] = '(!(|(objectClass=posixAccount)(objectClass=sambaSamAccount)))';
$this->filter->elements['MAIL']['unset'] = '';
$this->filter->elements['MAIL']['set'] = '';
}
if (class_available('sambaAccount')) {
$classes[]= 'sambaSamAccount';
} else {
/* If samba plugin is not installed, ignore samba filter */
$this->filter->elements['SAMBA']['unset'] = '';
$this->filter->elements['SAMBA']['set'] = '';
}
/* The FUNCTIONAL filter must not use inexisting classes */
$this->filter->elements['FUNCTIONAL']['set'] = '(!(|(objectClass='.implode(')(objectClass=', $classes).')))';
}
function renderList ()
{
$smarty = get_smarty();
$smarty->assign('USE_MAIL', class_available('mailAccount'));
$smarty->assign('USE_SAMBA', class_available('sambaAccount'));
return parent::renderList();
}
......
......@@ -12,7 +12,9 @@
{if $USE_MAIL}
{$MAIL}&nbsp;<label for='MAIL'>{t}Show Mail users{/t}</label><br/>
{/if}
{$SAMBA}&nbsp;<label for='SAMBA'>{t}Show Samba users{/t}</label><br/>
{if $USE_SAMBA}
{$SAMBA}&nbsp;<label for='SAMBA'>{t}Show Samba users{/t}</label><br/>
{/if}
<div style="width:100%;border-top:1px solid #AAAAAA"></div>
{$SCOPE}
......
......@@ -55,7 +55,8 @@
<tag>FUNCTIONAL</tag>
<default>true</default>
<unset></unset>
<set>(!(|(objectClass=posixAccount)(objectClass=sambaSamAccount)(objectClass=gosaMailAccount)))</set>
<!-- The set tag content is defined in userManagement::configureFilter -->
<set>UNSET</set>
</element>
<element>
......
......@@ -96,7 +96,7 @@ class Step_Checks extends setupStep
$basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
/* Check for iconv */
$N = msgPool::checkingFor("inconv");
$N = msgPool::checkingFor("iconv");
$D = _("FusionDirectory requires this module for the samba integration.");
$S = msgPool::installPhpModule("iconv");
$R = is_callable("iconv");
......
......@@ -532,10 +532,21 @@ class Step_Migrate extends setupStep
/* Get all invisible users */
$ldap->cd($config->current['BASE']);
$res = $ldap->search("(&(|(objectClass=posixAccount)(objectClass=organizationalPerson)(objectClass=OpenLDAPperson))(!(objectClass=inetOrgPerson))(!(&(objectClass=Account)(objectClass=sambaSamAccount)))(uid=*))", array("sn","givenName","cn","uid"));
$res = $ldap->search(
'(&'.
'(|'.
'(objectClass=posixAccount)'.
'(objectClass=organizationalPerson)'.
'(objectClass=OpenLDAPperson)'.
')'.
'(!(objectClass=inetOrgPerson))'.
'(uid=*)'.
')',
array('sn','givenName','cn','uid')
);
while ($attrs = $ldap->fetch()) {
if (!preg_match("/,dc=addressbook,/", $attrs['dn'])) {
if (!preg_match('/,dc=addressbook,/', $attrs['dn'])) {
$attrs['checked'] = FALSE;
$attrs['before'] = "";
$attrs['after'] = "";
......
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