Aleksander Machniak
2014-08-11 ec2733f6c35ca3d470172f9e35ae94399a78c2f4
Add support for groups
2 files modified
31 ■■■■ changed files
plugins/acl/acl.php 22 ●●●●● patch | view | raw | blame | history
plugins/acl/config.inc.php.dist 9 ●●●● patch | view | raw | blame | history
plugins/acl/acl.php
@@ -112,6 +112,20 @@
                    $keys[]  = $display ?: $user['name'];
                }
            }
            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;
                    }
                }
            }
        }
        if (count($users)) {
@@ -448,9 +462,13 @@
        $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)) {
plugins/acl/config.inc.php.dist
@@ -16,10 +16,15 @@
// 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');
?>