summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-08-11 03:35:07 -0400
committerAleksander Machniak <alec@alec.pl>2014-08-12 06:10:30 -0400
commita1bb59d601ea44a49228cf81c1b18a2b2cb828a0 (patch)
treebeb04b4c97710b9fa02447963c467c8972bf5535 /plugins
parentdddb9dee612e56298869422700aff0fba187a842 (diff)
Add support for groups
Diffstat (limited to 'plugins')
-rw-r--r--plugins/acl/acl.php22
-rw-r--r--plugins/acl/config.inc.php.dist9
2 files changed, 27 insertions, 4 deletions
diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php
index 681ef0ee9..a8b8f58ad 100644
--- a/plugins/acl/acl.php
+++ b/plugins/acl/acl.php
@@ -111,6 +111,20 @@ class acl extends rcube_plugin
$users[] = $user;
}
}
+
+ if ($this->rc->config->get('acl_groups')) {
+ $prefix = $this->rc->config->get('acl_group_prefix');
+ $result = $this->ldap->list_groups($search, $mode);
+
+ foreach ($result as $record) {
+ $group = $record['name'];
+
+ if ($group) {
+ $users[] = array('name' => ($prefix ? $prefix : '') . $group, 'display' => $group);
+ $keys[] = $group;
+ }
+ }
+ }
}
sort($users, SORT_LOCALE_STRING);
@@ -439,9 +453,13 @@ class acl extends rcube_plugin
$result = 0;
foreach ($users as $user) {
- $user = trim($user);
+ $user = trim($user);
+ $prefix = $this->rc->config->get('acl_groups') ? $this->rc->config->get('acl_group_prefix') : '';
- if (!empty($this->specials) && in_array($user, $this->specials)) {
+ if ($prefix && strpos($user, $prefix) === 0) {
+ $username = $user;
+ }
+ else if (!empty($this->specials) && in_array($user, $this->specials)) {
$username = $this->gettext($user);
}
else if (!empty($user)) {
diff --git a/plugins/acl/config.inc.php.dist b/plugins/acl/config.inc.php.dist
index 3f0b1efb6..de1f8b5d2 100644
--- a/plugins/acl/config.inc.php.dist
+++ b/plugins/acl/config.inc.php.dist
@@ -16,10 +16,15 @@ $config['acl_users_field'] = 'mail';
// The LDAP search filter will be &'d with search queries
$config['acl_users_filter'] = '';
+// Enable LDAP groups in user autocompletion.
+// Note: LDAP addressbook defined in acl_users_source must include groups config
+$config['acl_groups'] = false;
+
+// Prefix added to the group name to build IMAP ACL identifier
+$config['acl_group_prefix'] = 'group:';
+
// Include the following 'special' access control subjects in the ACL dialog;
// Defaults to array('anyone', 'anonymous') (not when set to an empty array)
// Example: array('anyone') to exclude 'anonymous'.
// Set to an empty array to exclude all special aci subjects.
$config['acl_specials'] = array('anyone', 'anonymous');
-
-?>