• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/bizprocdocument.php
  • Класс: BitrixDiskBizProcDocument
  • Вызов: BizProcDocument::publishDocument
static function publishDocument($documentId)
{
	$documentId = intval($documentId);
	if($documentId <= 0)
	{
		throw new CBPArgumentNullException("documentId");
	}

	/** @var File $file */
	$file = File::loadById($documentId, array('STORAGE'));
	if(!$file)
	{
		return false;
	}

	$rightsManager = Driver::getInstance()->getRightsManager();
	$rights = $rightsManager->getAllListNormalizeRights($file);
	if(count($rights) != 1)
	{
		//we have many rights (not only CR). And it means that document already published.
		return $file->getId();
	}
	$aloneRight = array_pop($rights);
	if($aloneRight['ACCESS_CODE'] != 'CR')
	{
		return $file->getId();
	}
	//delete single right with ACCESS_CODE "CR". And file will become inherited rights.
	$rightsManager->set($file, array());

	return $file->getId();
}