public static function EnsureAllResponsibilityImported($userID, $reset = false) { $userID = intval($userID); if ($userID <= 0) { $userID = CCrmSecurityHelper::GetCurrentUser(); } $reset = (bool) $reset; $optionName = 'sl_subscr_import'; if ($reset || CUserOptions::GetOption('crm', $optionName, 'N', $userID) !== 'Y') { self::EnsureResponsibilityImported(CCrmOwnerType::Lead, $userID); self::EnsureResponsibilityImported(CCrmOwnerType::Contact, $userID); self::EnsureResponsibilityImported(CCrmOwnerType::Company, $userID); self::EnsureResponsibilityImported(CCrmOwnerType::Deal, $userID); self::EnsureResponsibilityImported(CCrmOwnerType::Activity, $userID); CUserOptions::SetOption('crm', $optionName, 'Y', false, $userID); } }
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/bx_root.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php'; if (!defined('LANGUAGE_ID')) { $dbSite = CSite::GetByID(SITE_ID); $arSite = $dbSite ? $dbSite->Fetch() : null; define('LANGUAGE_ID', $arSite ? $arSite['LANGUAGE_ID'] : 'en'); } //session_write_close(); if (!CModule::IncludeModule('crm')) { die; } if (CModule::IncludeModule('compression')) { CCompress::Disable2048Spaces(); } global $APPLICATION, $DB; $curUser = CCrmSecurityHelper::GetCurrentUser(); if (!$curUser || !$curUser->IsAuthorized() || !check_bitrix_sessid() || $_SERVER['REQUEST_METHOD'] != 'POST') { die; } //$langID = isset($_REQUEST['lang_id'])? $_REQUEST['lang_id']: LANGUAGE_ID; //__IncludeLang(dirname(__FILE__).'/lang/'.$langID.'/'.basename(__FILE__)); CUtil::JSPostUnescape(); if (!function_exists('__CrmMobileDealEditEndResonse')) { function __CrmMobileDealEditEndResonse($result) { $GLOBALS['APPLICATION']->RestartBuffer(); Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET); if (!empty($result)) { echo CUtil::PhpToJSObject($result); } require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php';
public static function IsAuthorized() { return CCrmSecurityHelper::GetCurrentUser()->IsAuthorized(); }
protected function getWebDavSettings() { if ($this->webdavSettings !== null) { return $this->webdavSettings; } if (!CModule::IncludeModule('webdav')) { throw new RestException('Could not load webdav module.'); } $opt = COption::getOptionString('webdav', 'user_files', null); if ($opt == null) { throw new RestException('Could not find webdav settings.'); } $user = CCrmSecurityHelper::GetCurrentUser(); $opt = unserialize($opt); $iblockID = intval($opt[CSite::GetDefSite()]['id']); $userSectionID = CWebDavIblock::getRootSectionIdForUser($iblockID, $user->GetID()); if (!is_numeric($userSectionID) || $userSectionID <= 0) { throw new RestException('Could not find webdav section for user ' . $user->GetLastName() . '.'); } return $this->webdavSettings = array('IBLOCK_ID' => $iblockID, 'IBLOCK_SECTION_ID' => intval($userSectionID)); }
public static function CanEditOtherSettings($user = null) { if (!($user !== null && (get_class($user) === 'CUser' || $user instanceof CUser))) { $user = CCrmSecurityHelper::GetCurrentUser(); } return $user->CanDoOperation('edit_other_settings'); }