Commit d14cc0b8 authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Benoit Mortier
Browse files

Fixes: #1922 handling foreignKeys in group and ogroup

parent c3886d70
......@@ -1144,9 +1144,11 @@ class group extends plugin
function foreignKeyUpdate ($field, $oldvalue, $newvalue, $source)
{
if ($field == 'memberUid' && $source == 'uid') {
if (($field == 'memberUid') && ($source['CLASS'] == 'user') && ($source['FIELD'] == 'uid')) {
if (isset($this->memberUid[$oldvalue])) {
$this->removeUser($oldvalue);
if ($source['MODE'] != 'copy') {
$this->removeUser($oldvalue);
}
$this->addUser($newvalue);
}
} else {
......@@ -1156,7 +1158,7 @@ class group extends plugin
function foreignKeyCheck ($field, $value, $source)
{
if ($field == 'memberUid' && $source == 'uid') {
if (($field == 'memberUid') && ($source['CLASS'] == 'user') && ($source['FIELD'] == 'uid')) {
return isset($this->memberUid[$value]);
} else {
return parent::foreignKeyCheck($field, $value, $source);
......
......@@ -887,6 +887,29 @@ class ogroup extends plugin
$this->handle_post_events("remove");
}
function foreignKeyUpdate ($field, $oldvalue, $newvalue, $source)
{
if (($field == 'member') && ($source['FIELD'] == 'dn')) {
if (isset($this->member[$oldvalue])) {
if ($source['MODE'] != 'copy') {
unset($this->member[$oldvalue]);
}
$this->member[$newvalue] = $newvalue;
}
} else {
return parent::foreignKeyUpdate($field, $oldvalue, $newvalue, $source);
}
}
function foreignKeyCheck ($field, $value, $source)
{
if (($field == 'member') && ($source['FIELD'] == 'dn')) {
return isset($this->member[$value]);
} else {
return parent::foreignKeyCheck($field, $value, $source);
}
}
function IsReleaseManagementActivated()
{
/* Check if we should enable the release selection */
......@@ -908,8 +931,21 @@ class ogroup extends plugin
'icon' => 'plugins/ogroups/images/iconMini.png',
'tabClass' => 'ogrouptabs',
)),
"plProvidedAcls"=> array(
'plForeignKeys' => array(
'member' => array(
array('user'),
array('group'),
array('application'),
array('server'),
array('workstation'),
array('winstation'),
array('terminal'),
array('phone'),
array('printer'),
)
),
"plProvidedAcls" => array(
"cn" => _("Name"),
"base" => _("Base"),
"description" => _("Description"),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment