Storage::addFolder

  1. Bitrix24 API (v. 23.675.0)
  2. disk
  3. Storage
  4. addFolder
  • Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/rest/service/storage.php
  • Класс: Bitrix\Disk\Rest\Service\Storage
  • Вызов: Storage::addFolder
protected function addFolder($id, array $data, array $rights = array())
{
	if(!$this->checkRequiredInputParams($data, array('NAME')))
	{
		return null;
	}

	$storage = $this->getStorageById($id);
	$securityContext = $storage->getCurrentUserSecurityContext();
	if(!$storage->getRootObject()->canAdd($securityContext))
	{
		throw new AccessException;
	}
	if ($rights && !$storage->getRootObject()->canChangeRights($securityContext))
	{
		throw new AccessException;
	}

	$folder = $storage->addFolder(array(
		'NAME' => $data['NAME'],
		'CREATED_BY' => $this->userId
	), $rights);
	if(!$folder)
	{
		$this->errorCollection->add($storage->getErrors());
		return null;
	}

	return $folder;
}

Добавить комментарий