Skip to content
Snippets Groups Projects
Commit 7cdf9941 authored by Prasad's avatar Prasad
Browse files

Refactored access control on user-save operation.

parent 7d83afce
No related branches found
No related tags found
No related merge requests found
......@@ -15,8 +15,22 @@ class Users_Save_Action extends Vtiger_Save_Action {
$record = $request->get('record');
$recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
$currentUserModel = Users_Record_Model::getCurrentUserModel();
if(!Users_Privileges_Model::isPermitted($moduleName, 'Save', $record) || ($recordModel->isAccountOwner() &&
$currentUserModel->get('id') != $recordModel->getId() && !$currentUserModel->isAdminUser())) {
// Check for operation access.
$allowed = Users_Privileges_Model::isPermitted($moduleName, 'Save', $record);
if ($allowed) {
// Deny access if not administrator or account-owner or self
if(!$currentUserModel->isAdminUser()) {
if (empty($record)) {
$allowed = false;
} else if (!$recordModel->isAccountOwner() || ($currentUserModel->get('id') != $recordModel->getId())) {
$allowed = false;
}
}
}
if(!$allowed) {
throw new AppException('LBL_PERMISSION_DENIED');
}
}
......
  • Author Maintainer

    Also add fix 88716121 and 59d831f0

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment