addaccesscontroluser.hook.php (fogproject-1.5.5) | : | addaccesscontroluser.hook.php (fogproject-1.5.6) | ||
---|---|---|---|---|
skipping to change at line 101 | skipping to change at line 101 | |||
global $sub; | global $sub; | |||
if (!in_array($this->node, (array)self::$pluginsinstalled)) { | if (!in_array($this->node, (array)self::$pluginsinstalled)) { | |||
return; | return; | |||
} | } | |||
if ($node != 'user') { | if ($node != 'user') { | |||
return; | return; | |||
} | } | |||
if ($sub == 'pending') { | if ($sub == 'pending') { | |||
return; | return; | |||
} | } | |||
foreach ((array)$arguments['headerData'] as $index => &$str) { | $arguments['headerData'][] = _('Role'); | |||
if ($index == 5) { | ||||
$arguments['headerData'][$index] = _('Role'); | ||||
$arguments['headerData'][] = $str; | ||||
} | ||||
unset($str); | ||||
} | ||||
} | } | |||
/** | /** | |||
* This function modifies the data of the user page. | * This function modifies the data of the user page. | |||
* Add one column calls 'Role' | * Add one column calls 'Role' | |||
* | * | |||
* @param mixed $arguments The arguments to modify. | * @param mixed $arguments The arguments to modify. | |||
* | * | |||
* @return void | * @return void | |||
*/ | */ | |||
public function userData($arguments) | public function userData($arguments) | |||
skipping to change at line 130 | skipping to change at line 124 | |||
global $sub; | global $sub; | |||
if (!in_array($this->node, (array)self::$pluginsinstalled)) { | if (!in_array($this->node, (array)self::$pluginsinstalled)) { | |||
return; | return; | |||
} | } | |||
if ($node != 'user') { | if ($node != 'user') { | |||
return; | return; | |||
} | } | |||
if ($sub == 'pending') { | if ($sub == 'pending') { | |||
return; | return; | |||
} | } | |||
foreach ((array)$arguments['attributes'] as $index => &$str) { | $arguments['attributes'][] = array(); | |||
if ($index == 5) { | $arguments['templates'][] = '${role}'; | |||
$arguments['attributes'][$index] = array(); | ||||
$arguments['attributes'][] = $str; | ||||
} | ||||
unset($str); | ||||
} | ||||
foreach ((array)$arguments['templates'] as $index => &$str) { | ||||
if ($index == 5) { | ||||
$arguments['templates'][$index] = '${role}'; | ||||
$arguments['templates'][] = $str; | ||||
} | ||||
unset($str); | ||||
} | ||||
foreach ((array)$arguments['data'] as $index => &$vals) { | foreach ((array)$arguments['data'] as $index => &$vals) { | |||
$find = array( | $find = array( | |||
'userID' => $vals['id'] | 'userID' => $vals['id'] | |||
); | ); | |||
$Roles = self::getSubObjectIDs( | $Roles = self::getSubObjectIDs( | |||
'AccessControlAssociation', | 'AccessControlAssociation', | |||
$find, | $find, | |||
'accesscontrolID' | 'accesscontrolID' | |||
); | ); | |||
$cnt = count($Roles); | $cnt = count($Roles); | |||
skipping to change at line 213 | skipping to change at line 196 | |||
if ($cnt !== 1) { | if ($cnt !== 1) { | |||
$acID = 0; | $acID = 0; | |||
} else { | } else { | |||
$AccessControls = self::getSubObjectIDs( | $AccessControls = self::getSubObjectIDs( | |||
'AccessControl', | 'AccessControl', | |||
array('id' => $AccessControls) | array('id' => $AccessControls) | |||
); | ); | |||
$acID = $AccessControls[0]; | $acID = $AccessControls[0]; | |||
} | } | |||
self::arrayInsertAfter( | self::arrayInsertAfter( | |||
_('User Name'), | '<label for="name">' | |||
. _('User Name') | ||||
. '</label>', | ||||
$arguments['fields'], | $arguments['fields'], | |||
_('User Access Control'), | _('User Access Control'), | |||
self::getClass('AccessControlManager')->buildSelectBox( | self::getClass('AccessControlManager')->buildSelectBox( | |||
$acID | $acID | |||
) | ) | |||
); | ); | |||
} | } | |||
/** | /** | |||
* This function adds one entry in the roleUserAssoc table in the DB | * This function adds one entry in the roleUserAssoc table in the DB | |||
* | * | |||
End of changes. 3 change blocks. | ||||
22 lines changed or deleted | 7 lines changed or added |