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