mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
N°9233 - Check user access before acquiring lock on object (#844)
This commit is contained in:
@@ -2047,6 +2047,17 @@ EOF
|
||||
$sObjClass = utils::ReadParam('obj_class', '', false, 'class');
|
||||
$iObjKey = (int)utils::ReadParam('obj_key', 0, false, 'integer');
|
||||
|
||||
// Check user has access to the object before trying to acquire the lock
|
||||
$oSearch = new DBObjectSearch($sObjClass);
|
||||
$oSearch->AddCondition(MetaModel::DBGetKey($sObjClass), $iObjKey, '=');
|
||||
$oSet = new CMDBObjectSet($oSearch);
|
||||
if (
|
||||
false === $oSet->CountExceeds(0) ||
|
||||
UserRights::IsActionAllowed($sObjClass, UR_ACTION_MODIFY, $oSet) !== UR_ALLOWED_YES
|
||||
) {
|
||||
throw new SecurityException(Dict::S('UI:ObjectDoesNotExist'));
|
||||
}
|
||||
|
||||
$aResult = iTopOwnershipLock::AcquireLock($sObjClass, $iObjKey);
|
||||
if (false === $aResult['success']) {
|
||||
$aLockData = iTopOwnershipLock::IsLocked($sObjClass, $iObjKey);
|
||||
|
||||
Reference in New Issue
Block a user