Skip to content

Commit

Permalink
Merge pull request #792 from AlexKay85/master
Browse files Browse the repository at this point in the history
fixed some more issues with Reports' permissions
  • Loading branch information
AlexKay85 authored Mar 7, 2023
2 parents 06d27ce + d69115c commit 3e7c8c6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion modules/Settings/Profiles/models/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -592,12 +592,26 @@ protected function saveModulePermissions($moduleModel, $permissions) {
}

//Utility permissions
// delete previous permissions, just in case
$db->pquery('DELETE FROM vtiger_profile2utility WHERE profileid = ? AND tabid = ?;', array($profileId, $tabId));
// set default value to neq 1 and 'on' (NOT allowed) if not present for import and export
$mandatoryUtilities = array(5, 6);
if ($moduleModel->getName() == 'Reports') {
$mandatoryUtilities[] = 11;
}
foreach ($mandatoryUtilities AS $actionId) {
if (!isset($utilityIdsList[$actionId])) {
$utilityIdsList[$actionId] = 'off';
}
}
$i = 0;
$count = count($utilityIdsList);
$utilityInsertQuery .= 'INSERT INTO vtiger_profile2utility(profileid, tabid, activityid, permission) VALUES ';
foreach($utilityIdsList as $actionId => $permission) {
$actionEnabled = true;
$permissionValue = $this->tranformInputPermissionValue($permission);
if ($permissionValue == 0 || $moduleModel->getName() == 'Reports') {
$actionEnabled = true;
}
$utilityInsertQuery .= "($profileId, $tabId, $actionId, $permissionValue)";

if ($i !== $count-1) {
Expand Down

0 comments on commit 3e7c8c6

Please sign in to comment.