support device in host selection

This commit is contained in:
Roland Gruber 2014-04-12 12:35:05 +00:00
parent 88221fcbd4
commit 3fce6ba2a8
1 changed files with 11 additions and 4 deletions

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2009 - 2013 Roland Gruber
Copyright (C) 2009 - 2014 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -636,10 +636,17 @@ class nisnetgroup extends baseModule {
if ($this->cachedHostList != null) {
return $this->cachedHostList;
}
$this->cachedHostList = searchLDAPByAttribute('uid', '*', 'account', array('uid'), array('host'));
for ($i = 0; $i < sizeof($this->cachedHostList); $i++) {
$this->cachedHostList[$i] = $this->cachedHostList[$i]['uid'][0];
$this->cachedHostList = array();
$list = searchLDAPByFilter('(|(objectClass=account)(objectClass=device))', array('uid', 'cn'), array('host'));
foreach ($list as $attrs) {
if (!empty($attrs['uid'][0])) {
$this->cachedHostList[] = $attrs['uid'][0];
}
if (!empty($attrs['cn'][0])) {
$this->cachedHostList[] = $attrs['cn'][0];
}
}
$this->cachedHostList = array_values(array_unique($this->cachedHostList));
return $this->cachedHostList;
}