From 73ebc83d6301963b58f3e689984b4d0c4b7a8964 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Sat, 8 Sep 2012 13:13:22 +0200 Subject: [PATCH] Liste des groupes pour lesquels on ne force pas la configuration depuis la DB --- .../e-smith/db/configuration/defaults/mozilla-mcd/NoEnforceGroups | 1 + root/etc/e-smith/templates/usr/share/mozilla-mcd/conf.php/10All | 8 +++++++- root/usr/share/mozilla-mcd/firefox.php | 4 ++-- root/usr/share/mozilla-mcd/thunderbird.php | 4 ++-- 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 root/etc/e-smith/db/configuration/defaults/mozilla-mcd/NoEnforceGroups diff --git a/root/etc/e-smith/db/configuration/defaults/mozilla-mcd/NoEnforceGroups b/root/etc/e-smith/db/configuration/defaults/mozilla-mcd/NoEnforceGroups new file mode 100644 index 0000000..9380a69 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/mozilla-mcd/NoEnforceGroups @@ -0,0 +1 @@ +admins diff --git a/root/etc/e-smith/templates/usr/share/mozilla-mcd/conf.php/10All b/root/etc/e-smith/templates/usr/share/mozilla-mcd/conf.php/10All index 4a74f2d..7defc76 100644 --- a/root/etc/e-smith/templates/usr/share/mozilla-mcd/conf.php/10All +++ b/root/etc/e-smith/templates/usr/share/mozilla-mcd/conf.php/10All @@ -7,6 +7,12 @@ my $ldapbase = esmith::util::ldapBase ($DomainName); my $tbpref = ((${'mozilla-mcd'}{'TBEnforce'} || 'disabled') =~ m/^enabled|on|1|yes$/) ? "lockPref":"defaultPref"; my $ffpref = ((${'mozilla-mcd'}{'FFEnforce'} || 'disabled') =~ m/^enabled|on|1|yes$/) ? "lockPref":"defaultPref"; my $url = ${'mozilla-mcd'}{'HomeURL'} || 'https://auth.' . "$DomainName"; +my $noenforcegroups = ${'mozilla-mcd'}{'NoEnforceGroups'} || ''; +# Format as a PHP array +$noenforcegroups =~ s/^,+|,+$//g; +$noenforcegroups =~ s/^/'/g; +$noenforcegroups =~ s/$/'/g; +$noenforcegroups =~ s/[;,]/','/g; $OUT .=<<"EOF"; @@ -20,7 +26,7 @@ define('LDAP_SERVER', 'localhost'); define('TB_PREF', '$tbpref'); define('FF_PREF', '$ffpref'); define('HOME_URL', '$url'); - +\$NOENFORCEGROUPS = array($noenforcegroups); EOF diff --git a/root/usr/share/mozilla-mcd/firefox.php b/root/usr/share/mozilla-mcd/firefox.php index 86888e6..b48fe01 100644 --- a/root/usr/share/mozilla-mcd/firefox.php +++ b/root/usr/share/mozilla-mcd/firefox.php @@ -21,10 +21,10 @@ if(isset($_SERVER['QUERY_STRING']) && preg_match('/^.+@' . DOMAIN . '$/', $_SERV exit; } $pref = FF_PREF; - // Don't lock pref if the user is member of admins + // Don't lock pref if the user is member of some special groups // regardless of the setting foreach ($user[0]['posixmemberof'] as $group){ - if ($group == 'admins'){ + if (in_array($group, $NOENFORCEGROUPS)){ $pref = 'defaultPref'; break; } diff --git a/root/usr/share/mozilla-mcd/thunderbird.php b/root/usr/share/mozilla-mcd/thunderbird.php index 4fba2c6..3b15086 100644 --- a/root/usr/share/mozilla-mcd/thunderbird.php +++ b/root/usr/share/mozilla-mcd/thunderbird.php @@ -20,10 +20,10 @@ if(isset($_SERVER['QUERY_STRING']) && preg_match('/^.+@' . DOMAIN . '$/', $_SERV exit; } $pref = TB_PREF; - // Don't lock pref if the user is member of admins + // Don't lock pref if the user is member of some special groups // regardless of the setting foreach ($user[0]['posixmemberof'] as $group){ - if ($group == 'admins'){ + if (in_array($group, $NOENFORCEGROUPS)){ $pref = 'defaultPref'; break; }