it's no possible again to create a group. But something strange is going on when trying to edit a group
This commit is contained in:
parent
7feba33196
commit
9127486894
|
@ -241,11 +241,9 @@ class cache {
|
||||||
for ($i=0; $i<count($allowed_types); $i++) {
|
for ($i=0; $i<count($allowed_types); $i++) {
|
||||||
if ($allowed_types[$i]!='*') {
|
if ($allowed_types[$i]!='*') {
|
||||||
$function = '$suffix = $$this->config->get_'.ucfirst($allowed_types[$i]).'Suffix();';
|
$function = '$suffix = $$this->config->get_'.ucfirst($allowed_types[$i]).'Suffix();';
|
||||||
print $function;
|
|
||||||
print "<br>";
|
|
||||||
// *** fixme, where is get_DomainSuffix
|
// *** fixme, where is get_DomainSuffix
|
||||||
If ($scope != '*') //eval($function);
|
If ($scope != '*') //eval($function);
|
||||||
$suffix = call_user_func(array($$this->config, 'get_'.ucfirst($allowed_types[$i]).'Suffix'));
|
$suffix = call_user_func(array($this->config, 'get_'.ucfirst($allowed_types[$i]).'Suffix'));
|
||||||
else $suffix = '';
|
else $suffix = '';
|
||||||
if (substr($suffix, $dn)) $singlescope = $allowed_types[$i];
|
if (substr($suffix, $dn)) $singlescope = $allowed_types[$i];
|
||||||
}
|
}
|
||||||
|
@ -255,11 +253,13 @@ class cache {
|
||||||
// Everything seems to be OK, start processing data
|
// Everything seems to be OK, start processing data
|
||||||
// Get Scope
|
// Get Scope
|
||||||
foreach ($allowed_types as $scope) {
|
foreach ($allowed_types as $scope) {
|
||||||
$function = '$suffix = $this->config->get_'.ucfirst($scope).'Suffix();';
|
//$function = '$suffix = $this->config->get_'.ucfirst($scope).'Suffix();';
|
||||||
//eval($function);
|
//eval($function);
|
||||||
$suffix = call_user_func(array($$this->config, 'get_'.ucfirst($scope).'Suffix'));
|
if ($scope!='*') {
|
||||||
|
$suffix = call_user_func(array($this->config, 'get_'.ucfirst($scope).'Suffix'));
|
||||||
if (strpos($dn, $suffix)) $singlescope = $scope;
|
if (strpos($dn, $suffix)) $singlescope = $scope;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!isset($singlescope)) trigger_error(sprintf(_('Invalid dn: %s. DN not covered by any suffix.'), $dn), E_USER_WARN);
|
if (!isset($singlescope)) trigger_error(sprintf(_('Invalid dn: %s. DN not covered by any suffix.'), $dn), E_USER_WARN);
|
||||||
// Refresh Cache
|
// Refresh Cache
|
||||||
$this->refresh_cache();
|
$this->refresh_cache();
|
||||||
|
@ -326,6 +326,7 @@ class cache {
|
||||||
*/
|
*/
|
||||||
function getgrnam($gidNumber) {
|
function getgrnam($gidNumber) {
|
||||||
$dn_groups = $_SESSION['cache']->get_cache('gidNumber', 'posixGroup', 'group');
|
$dn_groups = $_SESSION['cache']->get_cache('gidNumber', 'posixGroup', 'group');
|
||||||
|
if (is_array($dn_groups)) {
|
||||||
$DNs = array_keys($dn_groups);
|
$DNs = array_keys($dn_groups);
|
||||||
foreach ($DNs as $DN) {
|
foreach ($DNs as $DN) {
|
||||||
if ($dn_groups[$DN][0]==$gidNumber)
|
if ($dn_groups[$DN][0]==$gidNumber)
|
||||||
|
@ -333,6 +334,8 @@ class cache {
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
else return -1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -338,7 +338,7 @@ function getAvailablePDFFields($scope) {
|
||||||
* @return array Available scopes
|
* @return array Available scopes
|
||||||
*/
|
*/
|
||||||
function getAvailableScopes() {
|
function getAvailableScopes() {
|
||||||
return array('user','group','host');
|
return array('user','group','host', 'domain');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -356,8 +356,7 @@ class accountContainer {
|
||||||
if (!is_string($type)) trigger_error(_('Argument of accountContainer must be string.'), E_USER_ERROR);
|
if (!is_string($type)) trigger_error(_('Argument of accountContainer must be string.'), E_USER_ERROR);
|
||||||
if (!is_string($base)) trigger_error(_('Argument of accountContainer must be string.'), E_USER_ERROR);
|
if (!is_string($base)) trigger_error(_('Argument of accountContainer must be string.'), E_USER_ERROR);
|
||||||
// *** fixme use global variable to determine allowed types
|
// *** fixme use global variable to determine allowed types
|
||||||
$allowed_types = array ( 'user', 'group', 'host', 'domain' );
|
if (!in_array($type, getAvailableScopes())) trigger_error(_('Account type not recognized.'), E_USER_ERROR);
|
||||||
if (!in_array($type, $allowed_types)) trigger_error(_('Account type not recognized.'), E_USER_ERROR);
|
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->base = $base;
|
$this->base = $base;
|
||||||
// Name of variables in session
|
// Name of variables in session
|
||||||
|
@ -1156,9 +1155,6 @@ class accountContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print $this->dn;
|
|
||||||
print $this->dn_orig;
|
|
||||||
print_r($attributes);
|
|
||||||
// Complete dn with uid or cn=
|
// Complete dn with uid or cn=
|
||||||
if ($this->type=='group') $search = 'cn';
|
if ($this->type=='group') $search = 'cn';
|
||||||
else $search = 'uid';
|
else $search = 'uid';
|
||||||
|
@ -1200,16 +1196,17 @@ class accountContainer {
|
||||||
}
|
}
|
||||||
// fixme *** ad update_cache after every ldap-change
|
// fixme *** ad update_cache after every ldap-change
|
||||||
|
|
||||||
|
print_r($attributes);
|
||||||
if (!$stopprocessing) {
|
if (!$stopprocessing) {
|
||||||
if ($this->dn != $this->dn_orig) {
|
if ($this->dn != $this->dn_orig) {
|
||||||
// move existing DN
|
// move existing DN
|
||||||
if ($this->dn_orig!='') {
|
if ($this->dn_orig!='') {
|
||||||
// merge attributes together
|
// merge attributes together
|
||||||
$attr = array_merge_recursive($attributes[$this->dn]['add'], $attributes[$this->dn]['notchanged'], $attributes[$this->dn]['modify']);
|
$attr = array_merge_recursive($attributes[$this->dn]['add'], $attributes[$this->dn]['notchanged'], $attributes[$this->dn]['modify']);
|
||||||
$success = @ldap_add($_SESSION[$this->ldap]->server(), $this->dn, $attr);
|
$success = ldap_add($_SESSION[$this->ldap]->server(), $this->dn, $attr);
|
||||||
if ($success) {
|
if ($success) {
|
||||||
$_SESSION[$this->cache]->update_cache($this->$dn, 'add', $attr);
|
$_SESSION[$this->cache]->update_cache($this->$dn, 'add', $attr);
|
||||||
$success = @ldap_delete($_SESSION[$this->ldap]->server(), $this->dn_orig);
|
$success = ldap_delete($_SESSION[$this->ldap]->server(), $this->dn_orig);
|
||||||
if (!$success) {
|
if (!$success) {
|
||||||
$errors[] = array('ERROR', 'LDAP', sprintf(_('Was unable to delete dn: %s.'), $this->dn_orig));
|
$errors[] = array('ERROR', 'LDAP', sprintf(_('Was unable to delete dn: %s.'), $this->dn_orig));
|
||||||
$stopprocessing = true;
|
$stopprocessing = true;
|
||||||
|
@ -1224,16 +1221,14 @@ class accountContainer {
|
||||||
}
|
}
|
||||||
// create complete new dn
|
// create complete new dn
|
||||||
else {
|
else {
|
||||||
print "XXXXXXXX";
|
|
||||||
$attr = array_merge_recursive($attributes[$this->dn]['add'], $attributes[$this->dn]['notchanged'], $attributes[$this->dn]['modify']);
|
$attr = array_merge_recursive($attributes[$this->dn]['add'], $attributes[$this->dn]['notchanged'], $attributes[$this->dn]['modify']);
|
||||||
print_r($attribtues);
|
$success = ldap_add($_SESSION[$this->ldap]->server(), $this->dn, $attr);
|
||||||
$success = ldap_add($_SESSION[$this->ldap]->server(), $this->dn, $attributes[$this->dn]['add']);
|
|
||||||
if (!$success) {
|
if (!$success) {
|
||||||
$errors[] = array('ERROR', 'LDAP', sprintf(_('Was unable to create dn: %s. This is possible a bug. Please check your ldap logs and send a bug report if it is a possible bug.'), $this->dn));
|
$errors[] = array('ERROR', 'LDAP', sprintf(_('Was unable to create dn: %s. This is possible a bug. Please check your ldap logs and send a bug report if it is a possible bug.'), $this->dn));
|
||||||
$stopprocessing = true;
|
$stopprocessing = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$_SESSION[$this->cache]->update_cache($this->$dn, 'add', $attributes[$this->dn]['add']);
|
$_SESSION[$this->cache]->update_cache($this->$dn, 'add', $attr);
|
||||||
}
|
}
|
||||||
unset($attributes[$this->dn]);
|
unset($attributes[$this->dn]);
|
||||||
}
|
}
|
||||||
|
@ -1278,6 +1273,7 @@ class accountContainer {
|
||||||
foreach ($attributes as $DN) {
|
foreach ($attributes as $DN) {
|
||||||
if (is_array($DN['lamdaemon']['command'])) $result = $this->lamdaemon($DN['lamdaemon']['command']);
|
if (is_array($DN['lamdaemon']['command'])) $result = $this->lamdaemon($DN['lamdaemon']['command']);
|
||||||
// Error somewhere in lamdaemon
|
// Error somewhere in lamdaemon
|
||||||
|
if (is_array($result))
|
||||||
foreach ($result as $singleresult) {
|
foreach ($result as $singleresult) {
|
||||||
if (is_array($singleresult)) {
|
if (is_array($singleresult)) {
|
||||||
if ($singleresult[0] = 'ERROR') $stopprocessing = true;
|
if ($singleresult[0] = 'ERROR') $stopprocessing = true;
|
||||||
|
|
|
@ -343,6 +343,7 @@ class posixGroup extends baseModule {
|
||||||
|
|
||||||
// Remove primary group from users from memberUid
|
// Remove primary group from users from memberUid
|
||||||
$users_dn = $_SESSION[$_SESSION[$this->base]->cache]->get_cache('gidNumber', 'posixAccount', 'user');
|
$users_dn = $_SESSION[$_SESSION[$this->base]->cache]->get_cache('gidNumber', 'posixAccount', 'user');
|
||||||
|
if (is_array($users_dn)) {
|
||||||
$DNs = array_keys($users_dn);
|
$DNs = array_keys($users_dn);
|
||||||
for ($i=0; $i<count($DNs); $i++) {
|
for ($i=0; $i<count($DNs); $i++) {
|
||||||
if ($users_dn[$DNs[$i]][0]==$this->attributes['gidNumber'][0]) {
|
if ($users_dn[$DNs[$i]][0]==$this->attributes['gidNumber'][0]) {
|
||||||
|
@ -354,6 +355,7 @@ class posixGroup extends baseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Change gids of users and hosts?
|
// Change gids of users and hosts?
|
||||||
if ($this->changegids) {
|
if ($this->changegids) {
|
||||||
|
@ -401,6 +403,8 @@ class posixGroup extends baseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add ObjectClass
|
||||||
|
$return[$_SESSION[$this->base]->dn]['notchanged']['objectClass'][0] = 'posixGroup';
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,8 +447,10 @@ class posixGroup extends baseModule {
|
||||||
$maxID = intval($this->moduleSettings['posixGroup_maxGID'][0]);
|
$maxID = intval($this->moduleSettings['posixGroup_maxGID'][0]);
|
||||||
$dn_gids = $_SESSION[$_SESSION[$this->base]->cache]->get_cache('gidNumber', 'posixGroup', '*');
|
$dn_gids = $_SESSION[$_SESSION[$this->base]->cache]->get_cache('gidNumber', 'posixGroup', '*');
|
||||||
// get_cache will return an array ( dn1 => array(uidnumber1), dn2 => array(uidnumber2), ... )
|
// get_cache will return an array ( dn1 => array(uidnumber1), dn2 => array(uidnumber2), ... )
|
||||||
|
if(is_array($dn_gids)) {
|
||||||
foreach ($dn_gids as $gid) $gids[] = $gid[0];
|
foreach ($dn_gids as $gid) $gids[] = $gid[0];
|
||||||
if(is_array($gids)) sort ($gids, SORT_NUMERIC);
|
sort ($gids, SORT_NUMERIC);
|
||||||
|
}
|
||||||
if ($this->attributes['gidNumber'][0]=='') {
|
if ($this->attributes['gidNumber'][0]=='') {
|
||||||
// No id-number given
|
// No id-number given
|
||||||
if ($this->orig['gidNumber'][0]=='') {
|
if ($this->orig['gidNumber'][0]=='') {
|
||||||
|
@ -628,6 +634,7 @@ class posixGroup extends baseModule {
|
||||||
function display_html_user($post, $profile=false) {
|
function display_html_user($post, $profile=false) {
|
||||||
// load list with all groups
|
// load list with all groups
|
||||||
$dn_users = $_SESSION[$_SESSION[$this->base]->cache]->get_cache('uid', 'posixAccount', 'user');
|
$dn_users = $_SESSION[$_SESSION[$this->base]->cache]->get_cache('uid', 'posixAccount', 'user');
|
||||||
|
if (is_array($dn_users)) {
|
||||||
foreach ($dn_users as $user) $users[] = $user[0];
|
foreach ($dn_users as $user) $users[] = $user[0];
|
||||||
// sort groups
|
// sort groups
|
||||||
sort($users, SORT_STRING);
|
sort($users, SORT_STRING);
|
||||||
|
@ -648,9 +655,10 @@ class posixGroup extends baseModule {
|
||||||
}
|
}
|
||||||
// sort users
|
// sort users
|
||||||
sort($users);
|
sort($users);
|
||||||
|
}
|
||||||
|
|
||||||
$return[] = array ( 0 => array ( 'kind' => 'fieldset', 'legend' => _("Group members"), 'value' =>
|
$return[] = array ( 0 => array ( 'kind' => 'fieldset', 'legend' => _("Group members"), 'value' =>
|
||||||
array ( 0 => array ( 0 => array ('kind' => 'fieldset', 'td' => array ('valign' => 'top'), 'legend' => _("Selected userss"), 'value' =>
|
array ( 0 => array ( 0 => array ('kind' => 'fieldset', 'td' => array ('valign' => 'top'), 'legend' => _("Selected users"), 'value' =>
|
||||||
array ( 0 => array ( 0 => array ( 'kind' => 'select', 'name' => 'removeusers[]', 'size' => '15', 'multiple', 'options' => $this->attributes['memberUid'])))),
|
array ( 0 => array ( 0 => array ( 'kind' => 'select', 'name' => 'removeusers[]', 'size' => '15', 'multiple', 'options' => $this->attributes['memberUid'])))),
|
||||||
1 => array ( 'kind' => 'table', 'value' => array ( 0 => array ( 0 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'addusers_button',
|
1 => array ( 'kind' => 'table', 'value' => array ( 0 => array ( 0 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'addusers_button',
|
||||||
'value' => '<=')), 1 => array ( 0 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'removeusers_button', 'value' => '=>' )),
|
'value' => '<=')), 1 => array ( 0 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'removeusers_button', 'value' => '=>' )),
|
||||||
|
|
|
@ -229,6 +229,8 @@ class sambaGroupMapping extends baseModule {
|
||||||
if (!$wrid) $this->attributes['sambaSID'][0] == $SID."-".($_SESSION[$this->base]->module['posixGroup']->attributes['gidNumber'][0]*2+1+$RIDbase);
|
if (!$wrid) $this->attributes['sambaSID'][0] == $SID."-".($_SESSION[$this->base]->module['posixGroup']->attributes['gidNumber'][0]*2+1+$RIDbase);
|
||||||
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig);
|
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig);
|
||||||
|
|
||||||
|
// Add ObjectClass
|
||||||
|
$return[$_SESSION[$this->base]->dn]['notchanged']['objectClass'][0] = 'sambaGroupMapping';
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue