public function resetRole($RoleId)
{
// Grab the value of Type for this role.
$RoleType = $this->SQL->getWhere('Role', array('RoleID' => $RoleId))->value('Type');
if ($RoleType == '') {
$RoleType = RoleModel::TYPE_MEMBER;
}
$Defaults = $this->getDefaults();
$RowDefaults = $this->getRowDefaults();
$ResetValues = array_fill_keys(array_keys($RowDefaults), 0);
if (array_key_exists($RoleType, $Defaults)) {
foreach ($Defaults[$RoleType] as $Specificity => $Permissions) {
$Permissions['RoleID'] = $RoleId;
$Permissions = array_merge($ResetValues, $Permissions);
if (strpos($Specificity, ':')) {
list($Junction, $JunctionId) = explode(':', $Specificity);
if ($Junction && $JunctionId) {
switch ($Junction) {
case 'Category':
default:
$Permissions['JunctionTable'] = $Junction;
$Permissions['JunctionColumn'] = 'PermissionCategoryID';
$Permissions['JunctionID'] = $JunctionId;
}
}
}
$this->save($Permissions);
}
}
}