Commit 6cc60ca6 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #4136 Removing core dependency to samba schema

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