• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/rightsmanager.php
  • Класс: BitrixDiskRightsManager
  • Вызов: RightsManager::cleanWrongNegativeRights
private function cleanWrongNegativeRights(BaseObject $object, array $rights)
{
	$dataSetOfRights = new DataSetOfRights($rights);
	$negativeRights = $dataSetOfRights->filterNegative();

	if ($negativeRights->isEmpty())
	{
		//there is only positive rights
		return $rights;
	}

	$validNegativeRights = [];
	$dataSetOfParentRights = new DataSetOfRights($this->getParentsRights($object->getId()));
	$positiveParentRights = $dataSetOfParentRights->filterPositive();

	foreach ($negativeRights as $negativeRight)
	{
		if ($positiveParentRights->isExists([
			'ACCESS_CODE' => $negativeRight['ACCESS_CODE'],
			'TASK_ID' => $negativeRight['TASK_ID'],
		]))
		{
			$validNegativeRights[] = $negativeRight;
		}
	}

	return array_merge($dataSetOfRights->filterPositive()->toArray(), $validNegativeRights);
}