public static function createInviteOnSection(array $sectionTargetData, array $sectionLinkData, $typeLibrary = self::ENTITY_TYPE_USER) { if (empty($sectionLinkData['IBLOCK_ID']) || empty($sectionLinkData['ID']) || empty($sectionLinkData['NAME']) || empty($sectionLinkData['CREATED_BY'])) { return false; } if (empty($sectionTargetData['IBLOCK_ID']) || empty($sectionTargetData['IBLOCK_SECTION_ID'])) { return false; } $typeLibrary = strtolower($typeLibrary); if ($typeLibrary != self::ENTITY_TYPE_USER && $typeLibrary != self::ENTITY_TYPE_GROUP && $typeLibrary != self::ENTITY_TYPE_SHARED) { return false; } if (!CWebDavTools::isIntranetUser($sectionLinkData['INVITE_USER_ID'])) { return false; } $exists = \Bitrix\Webdav\FolderInviteTable::getRow(array('filter' => array('INVITE_USER_ID' => $sectionLinkData['INVITE_USER_ID'], 'IBLOCK_ID' => $sectionLinkData['IBLOCK_ID'], 'SECTION_ID' => $sectionLinkData['ID']), 'select' => array('ID', 'LINK_SECTION_ID', 'IS_DELETED', 'IS_APPROVED'))); //rewrite old self-deleted by user invite if ($exists && !$exists['IS_DELETED'] && $exists['IS_APPROVED']) { return true; } if ($typeLibrary == self::ENTITY_TYPE_GROUP) { \Bitrix\Webdav\FolderInviteTable::addIfNonExists(array('INVITE_USER_ID' => $sectionLinkData['CREATED_BY'], 'USER_ID' => $sectionLinkData['CREATED_BY'], 'IBLOCK_ID' => $sectionLinkData['IBLOCK_ID'], 'SECTION_ID' => $sectionLinkData['ID'], 'IS_APPROVED' => CWebDavTools::allowAutoconnectShareGroupFolder(), 'IS_DELETED' => false, 'CAN_FORWARD' => false)); } elseif ($typeLibrary == self::ENTITY_TYPE_USER) { } return true; }