summaryrefslogtreecommitdiff
path: root/plugins/kolab_auth
diff options
context:
space:
mode:
authorroot <machniak@kolabsys.com>2013-12-06 13:11:05 (GMT)
committerroot <machniak@kolabsys.com>2013-12-06 13:11:05 (GMT)
commitab9c3db43af1ff6285c4bfe78da5aefbf4ae3393 (patch)
tree65c3cf0bfc7cbff475ee8c5d0c6b35c2af300117 /plugins/kolab_auth
parent93a915386a2acd6806d6cec2ef6f55b2b13c0a9a (diff)
downloadroundcubemail-plugins-kolab-ab9c3db43af1ff6285c4bfe78da5aefbf4ae3393.tar.gz
Improved role-based settings handling, especially 'skin' setting
Diffstat (limited to 'plugins/kolab_auth')
-rw-r--r--plugins/kolab_auth/kolab_auth.php36
1 files changed, 26 insertions, 10 deletions
diff --git a/plugins/kolab_auth/kolab_auth.php b/plugins/kolab_auth/kolab_auth.php
index 7ff5761..1fa7755 100644
--- a/plugins/kolab_auth/kolab_auth.php
+++ b/plugins/kolab_auth/kolab_auth.php
@@ -155,24 +155,27 @@ class kolab_auth extends rcube_plugin
if (!empty($role_plugins)) {
foreach ($role_plugins as $role_dn => $plugins) {
- $role_plugins[self::parse_ldap_vars($role_dn)] = $plugins;
+ $role_dn = self::parse_ldap_vars($role_dn);
+ if (!empty($role_plugins[$role_dn])) {
+ $role_plugins[$role_dn] = array_unique(array_merge((array)$role_plugins[$role_dn], $plugins));
+ } else {
+ $role_plugins[$role_dn] = $plugins;
+ }
}
}
if (!empty($role_settings)) {
foreach ($role_settings as $role_dn => $settings) {
- $role_settings[self::parse_ldap_vars($role_dn)] = $settings;
+ if (!empty($role_settings[$role_dn])) {
+ $role_settings[$role_dn] = array_merge((array)$role_settings[$role_dn], $settings);
+ } else {
+ $role_settings[$role_dn] = $settings;
+ }
}
}
foreach ($_SESSION['user_roledns'] as $role_dn) {
- if (isset($role_plugins[$role_dn]) && is_array($role_plugins[$role_dn])) {
- foreach ($role_plugins[$role_dn] as $plugin) {
- $this->require_plugin($plugin);
- }
- }
-
- if (isset($role_settings[$role_dn]) && is_array($role_settings[$role_dn])) {
+ if (!empty($role_settings[$role_dn]) && is_array($role_settings[$role_dn])) {
foreach ($role_settings[$role_dn] as $setting_name => $setting) {
if (!isset($setting['mode'])) {
$setting['mode'] = 'override';
@@ -194,7 +197,7 @@ class kolab_auth extends rcube_plugin
$dont_override = (array) $rcmail->config->get('dont_override');
- if (!isset($setting['allow_override']) || !$setting['allow_override']) {
+ if (empty($setting['allow_override'])) {
$rcmail->config->set('dont_override', array_merge($dont_override, array($setting_name)));
}
else {
@@ -208,6 +211,19 @@ class kolab_auth extends rcube_plugin
$rcmail->config->set('dont_override', $_dont_override);
}
}
+
+ if ($setting_name == 'skin') {
+ if ($rcmail->output->type == 'html') {
+ $rcmail->output->set_skin($setting['value']);
+ $rcmail->output->set_env('skin', $setting['value']);
+ }
+ }
+ }
+ }
+
+ if (!empty($role_plugins[$role_dn])) {
+ foreach ((array)$role_plugins[$role_dn] as $plugin) {
+ $this->require_plugin($plugin);
}
}
}