new type API
This commit is contained in:
parent
7d5310f588
commit
fb1ab48b38
|
@ -2,6 +2,7 @@
|
|||
use \LAM\PDF\PDFTable;
|
||||
use \LAM\PDF\PDFTableCell;
|
||||
use \LAM\PDF\PDFTableRow;
|
||||
use \LAM\TYPES\TypeManager;
|
||||
/*
|
||||
$Id$
|
||||
|
||||
|
@ -121,18 +122,21 @@ class nisNetGroupUser extends baseModule {
|
|||
return;
|
||||
}
|
||||
$this->uidOrig = $attr['uid'][0];
|
||||
$types = array('netgroup');
|
||||
$typeSettings = $_SESSION['config']->get_typeSettings();
|
||||
$typeManager = new TypeManager();
|
||||
$types = $typeManager->getConfiguredTypesForScope('netgroup');
|
||||
$groupList = array();
|
||||
foreach ($types as $type) {
|
||||
$filter = '(&(objectClass=nisNetgroup)(nisnetgrouptriple=*))';
|
||||
if (!empty($typeSettings['filter_' . $types[0]])) {
|
||||
$typeFilter = $typeSettings['filter_' . $types[0]];
|
||||
$typeFilter = $type->getAdditionalLdapFilter();
|
||||
if (!empty($typeFilter)) {
|
||||
if (strpos($typeFilter, '(') !== 0) {
|
||||
$typeFilter = '(' . $typeFilter . ')';
|
||||
}
|
||||
$filter = '(&' . $filter . $typeFilter . ')';
|
||||
}
|
||||
$groupList = searchLDAPByFilter($filter, array('dn', 'cn', 'nisnetgrouptriple'), $types);
|
||||
$groupsFound = searchLDAP($type->getSuffix(), $filter, array('dn', 'cn', 'nisnetgrouptriple'));
|
||||
$groupList = array_merge($groupList, $groupsFound);
|
||||
}
|
||||
$this->groupsOrig = array();
|
||||
$tripleRegex = '/^\\(([^,]*),([^,]*),([^,]*)\\)$/';
|
||||
foreach ($groupList as $group) {
|
||||
|
@ -639,26 +643,24 @@ class nisNetGroupUser extends baseModule {
|
|||
return $this->groupCache;
|
||||
}
|
||||
$return = array();
|
||||
$types = array('netgroup');
|
||||
$typeSettings = $_SESSION['config']->get_typeSettings();
|
||||
if (sizeof($types) > 0) {
|
||||
$typeManager = new TypeManager();
|
||||
$types = $typeManager->getConfiguredTypesForScope('netgroup');
|
||||
foreach ($types as $type) {
|
||||
$filter = '(objectClass=nisNetgroup)';
|
||||
if (!empty($typeSettings['filter_' . $type])) {
|
||||
$typeFilter = $typeSettings['filter_' . $type];
|
||||
$typeFilter = $type->getAdditionalLdapFilter();
|
||||
if (!empty($typeFilter)) {
|
||||
if (strpos($typeFilter, '(') !== 0) {
|
||||
$typeFilter = '(' . $typeFilter . ')';
|
||||
}
|
||||
$filter = '(&' . $filter . $typeFilter . ')';
|
||||
}
|
||||
$results = searchLDAPByFilter($filter, array('cn', 'dn', 'nisnetgrouptriple'), array($type));
|
||||
$results = searchLDAP($type->getSuffix(), $filter, array('cn', 'dn', 'nisnetgrouptriple'));
|
||||
for ($i = 0; $i < sizeof($results); $i++) {
|
||||
if (isset($results[$i]['cn'][0]) && isset($results[$i]['dn'])) {
|
||||
$return[] = $results[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->groupCache = $return;
|
||||
return $return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue