From 0f711e7bd744053d89997d0c8c16938c8d1b9170 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 26 Oct 2014 06:34:27 -0400
Subject: [PATCH] Merge pull request #234 from bnogas/master-p3

---
 plugins/acl/acl.php |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php
index 33bd91e..cc4d996 100644
--- a/plugins/acl/acl.php
+++ b/plugins/acl/acl.php
@@ -114,14 +114,16 @@
             }
 
             if ($this->rc->config->get('acl_groups')) {
-                $prefix = $this->rc->config->get('acl_group_prefix');
-                $result = $this->ldap->list_groups($search, $mode);
+                $prefix      = $this->rc->config->get('acl_group_prefix');
+                $group_field = $this->rc->config->get('acl_group_field') ? $this->rc->config->get('acl_group_field') : 'name';
+                $result      = $this->ldap->list_groups($search, $mode);
 
                 foreach ($result as $record) {
-                    $group = $record['name'];
+                    $group    = $record['name'];
+                    $group_id = is_array($record[$group_field]) ? $record[$group_field][0] : $record[$group_field];
 
                     if ($group) {
-                        $users[] = array('name' => ($prefix ? $prefix : '')  . $group, 'display' => $group);
+                        $users[] = array('name' => ($prefix ? $prefix : '')  . $group_id, 'display' => $group);
                         $keys[]  = $group;
                     }
                 }

--
Gitblit v1.9.1