• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/rightsmanager.php
  • Класс: BitrixDiskSimpleReBuilder
  • Вызов: SimpleReBuilder::getNewSimpleRight
private function getNewSimpleRight(array $specificRights, array $parentRights, array $parentSimpleRights)
{
	list($canRead, $mayCannotRead) = $this->splitRightsByReadable($specificRights);
	if(count($mayCannotRead))
	{
		//analyze negative + positive read rights. Clean pair
		$rightsManager = Driver::getInstance()->getRightsManager();
		$readableRightsFromParents = array();
		foreach($parentRights as $parentRight)
		{
			if(!$rightsManager->containsOperationInTask($rightsManager::OP_READ, $parentRight['TASK_ID']))
			{
				continue;
			}
			$key = $parentRight['TASK_ID'] . '-' . $parentRight['ACCESS_CODE'];
			if(empty($parentRight['NEGATIVE']))
			{
				$readableRightsFromParents[$key] = $parentRight;
				continue;
			}
			elseif(isset($readableRightsFromParents[$key]))
			{
				unset($readableRightsFromParents[$key]);
			}
		}
		unset($parentRight);
		//clean parent read right if we have negative right on this task_id + access_code
		foreach($readableRightsFromParents as $i => $right)
		{
			if(isset($mayCannotRead[$right['ACCESS_CODE']]))
			{
				foreach($mayCannotRead[$right['ACCESS_CODE']] as $cannotReadRight)
				{
					if($cannotReadRight['TASK_ID'] == $right['TASK_ID'])
					{
						unset($readableRightsFromParents[$i]);
						break;
					}
				}
				unset($cannotReadRight);
			}
		}
		unset($right);
		//in $readableRightsFromParents stay only readable rights by task and access code.
		$simpleRights = $readableRightsFromParents;
	}
	else
	{
		$simpleRights = $parentSimpleRights;
	}
	foreach($canRead as $accessCode => $rights)
	{
		$simpleRights = array_merge($simpleRights, $rights);
	}
	unset($accessCode, $rights);

	return $simpleRights;
}