Apply group filter on mod_vcard_ldap

tags/ipasserelle-im-0.2.18-1
Daniel Berteaud 12 years ago
parent e4b10dace7
commit 2087fbfc19
  1. 12
      root/etc/e-smith/templates/etc/ejabberd/ejabberd.cfg/55AuthConf
  2. 10
      root/etc/e-smith/templates/etc/ejabberd/ejabberd.cfg/86ModuleVcardLDAP

@ -17,16 +17,16 @@ HERE
# (Only available on iPasserelle) # (Only available on iPasserelle)
our @groups = split(/[;,]/, ($ejabberd{'AllowedGroups'} || '')); our @groups = split(/[;,]/, ($ejabberd{'AllowedGroups'} || ''));
my $filter = ''; our $groupFilter = '';
if (scalar(@groups) == 1){ if (scalar(@groups) == 1){
$filter = "(posixMemberOf=$groups[0])"; $groupFilter = "(posixMemberOf=$groups[0])";
} }
elsif (scalar(@groups) gt 1){ elsif (scalar(@groups) gt 1){
$filter = '(|'; $groupFilter = '(|';
$filter .= "(posixMemberOf=$_)" foreach (@groups); $groupFilter .= "(posixMemberOf=$_)" foreach (@groups);
$filter .= ')'; $groupFilter .= ')';
} }
$OUT .= ($filter eq '') ? '' : '{ldap_filter, "' . $filter . '"}.'; $OUT .= ($groupFilter eq '') ? '' : '{ldap_filter, "' . $groupFilter . '"}.';
} }

@ -1,9 +1,17 @@
{ {
my $filter = '';
if (scalar(@groups) ge 1){
$filter = "(&(objectClass=inetOrgPerson)$groupFilter)";
}
else{
$filter = "(objectClass=inetOrgPerson)";
}
$OUT .=<<"HERE"; $OUT .=<<"HERE";
,{mod_vcard_ldap, [ ,{mod_vcard_ldap, [
{ldap_base, "ou=Users,$base"}, {ldap_base, "ou=Users,$base"},
{ldap_filter, "(objectClass=inetOrgPerson)"}, {ldap_filter, "$filter"},
{ldap_vcard_map, {ldap_vcard_map,
%% vcard patterns %% vcard patterns
[{"NICKNAME", "%u", []}, % just use user's part of JID as his nickname [{"NICKNAME", "%u", []}, % just use user's part of JID as his nickname

Loading…
Cancel
Save