private function isConnected($userId, array $sectionData) { return (bool) \Bitrix\Webdav\FolderInviteTable::getRow(array('filter' => array('=INVITE_USER_ID' => $userId, '=IS_APPROVED' => true, '=IBLOCK_ID' => $sectionData['IBLOCK_ID'], '=SECTION_ID' => $sectionData['SECTION_ID']))); }
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; }
public function processActionLoadUsersForDetailUserShare(array $params) { $this->params = $params; $attachSectionData = $this->getSectionDataByAttachObject($params['attachObject']); $isLinkSection = false; if ($attachSectionData) { $exists = FolderInviteTable::getRow(array('filter' => array('INVITE_USER_ID' => $params['attachToUserId'], 'IBLOCK_ID' => $attachSectionData['IBLOCK_ID'], 'SECTION_ID' => $attachSectionData['SECTION_ID']), 'select' => array('ID'))); if ($exists) { $isLinkSection = true; } } $userListType = $this->params['userListType']; if ($userListType == 'can_edit') { return array_merge(array('IS_LINK_SECTION' => $isLinkSection), $this->getListConnectedUsersCanEdited($attachSectionData)); } elseif ($userListType == 'cannot_edit') { return array_merge(array('IS_LINK_SECTION' => $isLinkSection), $this->getListConnectedUsersCannotEdited($attachSectionData)); } elseif ($userListType == 'disconnect') { return array_merge(array('IS_LINK_SECTION' => $isLinkSection), $this->getListDisconnected($attachSectionData)); } }
$arResult["URL"]["ELEMENT"]["BP_VIEW"] = CComponentEngine::MakePathFromTemplate($arParams["WEBDAV_BIZPROC_VIEW_URL"], array("ELEMENT_ID" => $arParams["ELEMENT_ID"])); $arResult["URL"]["HELP"] = CComponentEngine::MakePathFromTemplate($arParams["HELP_URL"], array()); $arResult["URL"]["CONNECTOR"] = CComponentEngine::MakePathFromTemplate($arParams["CONNECTOR_URL"], array()); $arResult["URL"]["SUBSCRIBE"] = CComponentEngine::MakePathFromTemplate($arParams["SECTIONS_URL"], array("PATH" => $path, "SECTION_ID" => $arParams["SECTION_ID"])); $arResult["URL"]["UNSUBSCRIBE"] = WDAddPageParams($arResult["URL"]["SUBSCRIBE"], array("subscribe_forum" => "N", "sessid" => bitrix_sessid())); $arResult["URL"]["SUBSCRIBE"] = WDAddPageParams($arResult["URL"]["SUBSCRIBE"], array("subscribe_forum" => "Y", "sessid" => bitrix_sessid())); /*************** For Custom components *****************************/ $arParams["USE_BIZPROC"] = $ob->workflow == "bizproc" ? "Y" : "N"; $arParams["USE_WORKFLOW"] = $ob->workflow == "workflow" ? "Y" : "N"; $arResult["URL"]["CHAIN"] = array(array("URL" => CComponentEngine::MakePathFromTemplate($arParams["SECTIONS_URL"], array("PATH" => "", "SECTION_ID" => 0)), "TITLE" => empty($arParams["STR_TITLE"]) ? GetMessage("WD_TITLE") : $arParams["STR_TITLE"])); $arResult['BP_PARAM_REQUIRED'] = 'N'; if ($ob->Type == 'iblock') { $arResult['BP_PARAM_REQUIRED'] = $ob->BPParameterRequired() ? 'Y' : 'N'; } /******************************************************************** /Data ********************************************************************/ $arResult['GROUP_DISK'] = array(); if ($ob->attributes['group_id'] && $ob->e_rights && $ob->GetPermission('SECTION', $ob->arParams['item_id'], 'section_edit') && CWebDavTools::isIntranetUser($USER->getId())) { $rootSectionDataForGroup = CWebDavIblock::getRootSectionDataForGroup($ob->attributes['group_id']); $arResult['GROUP_DISK']['CONNECTED'] = !\Bitrix\Webdav\FolderInviteTable::getRow(array('filter' => array('=INVITE_USER_ID' => $USER->getId(), '=USER_ID' => $USER->getId(), '=IS_APPROVED' => true, '=IBLOCK_ID' => $rootSectionDataForGroup['IBLOCK_ID'], '=SECTION_ID' => $rootSectionDataForGroup['SECTION_ID']))); $arResult['GROUP_DISK']['CONNECT_URL'] = $APPLICATION->GetCurUri(http_build_query(array('toWDController' => 1, 'wdaction' => 'connect', 'group' => $ob->attributes['group_id']))); $arResult['GROUP_DISK']['DISCONNECT_URL'] = $APPLICATION->GetCurUri(http_build_query(array('toWDController' => 1, 'wdaction' => 'disconnect', 'group' => $ob->attributes['group_id']))); $arResult['GROUP_DISK']['DETAIL_URL'] = $APPLICATION->GetCurUri(http_build_query(array('toWDController' => 1, 'wdaction' => 'detail_group_connect', 'group' => $ob->attributes['group_id']))); } $this->IncludeComponentTemplate(); if (!$ob->e_rights && $ob->CheckRight($arParams["PERMISSION"], "section_read") < "R") { ShowError(GetMessage("WD_ACCESS_DENIED")); return 0; } return array("PERMISSION" => $arParams["PERMISSION"]);