Example #1
0
 /**
  * Gets security context (access provider) for user.
  * Attention! File/Folder can use anywhere and SecurityContext have to check rights anywhere (any module).
  * @param mixed $user User which use for check rights.
  * @return SecurityContext
  */
 public function getSecurityContextByUser($user)
 {
     if ($this->isCurrentUser($user)) {
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         if (Loader::includeModule('socialnetwork') && \CSocnetUser::isCurrentUserModuleAdmin()) {
             return new FakeSecurityContext($user);
         }
         if (UserModel::isCurrentUserAdmin()) {
             return new FakeSecurityContext($user);
         }
     } else {
         $userId = UserModel::resolveUserId($user);
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         if ($userId && Loader::includeModule('socialnetwork') && \CSocnetUser::isUserModuleAdmin($userId)) {
             return new FakeSecurityContext($user);
         }
         try {
             if ($userId && ModuleManager::isModuleInstalled('bitrix24') && Loader::includeModule('bitrix24') && \CBitrix24::isPortalAdmin($userId)) {
                 return new FakeSecurityContext($user);
             } elseif ($userId) {
                 //Check user group 1 ('Admins')
                 $tmpUser = new \CUser();
                 $arGroups = $tmpUser->getUserGroup($userId);
                 if (in_array(1, $arGroups)) {
                     return new FakeSecurityContext($user);
                 }
             }
         } catch (\Exception $e) {
         }
     }
     return new DiskSecurityContext($user);
 }
Example #2
0
 /**
  * Gets security context (access provider) for user.
  * Attention! File/Folder can use anywhere and SecurityContext have to check rights anywhere (any module).
  * @param mixed $user User which use for check rights.
  * @return SecurityContext
  */
 public function getSecurityContextByUser($user)
 {
     if ($this->isCurrentUser($user)) {
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         if (Loader::includeModule('socialnetwork') && \CSocnetUser::isCurrentUserModuleAdmin()) {
             return new FakeSecurityContext($user);
         }
         if (UserModel::isCurrentUserAdmin()) {
             return new FakeSecurityContext($user);
         }
     }
     return new DiskSecurityContext($user);
 }
Example #3
0
 protected function getSecurityContextByUser($user)
 {
     $diskSecurityContext = new DiskSecurityContext($user);
     if (Loader::includeModule('socialnetwork')) {
         if (\CSocnetUser::isCurrentUserModuleAdmin()) {
             $diskSecurityContext = new FakeSecurityContext($user);
         }
     }
     if (User::isCurrentUserAdmin()) {
         $diskSecurityContext = new FakeSecurityContext($user);
     }
     return $diskSecurityContext;
 }
Example #4
0
 private function getSecurityContextByUser($user)
 {
     $diskSecurityContext = new DiskSecurityContext($user);
     if (Loader::includeModule('socialnetwork')) {
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         if (\CSocnetUser::isCurrentUserModuleAdmin()) {
             $diskSecurityContext = new FakeSecurityContext($user);
         }
     }
     if (User::isCurrentUserAdmin()) {
         $diskSecurityContext = new FakeSecurityContext($user);
     }
     return $diskSecurityContext;
 }
Example #5
0
    $arParams["LOG_DATE_DAYS"] = 7;
}
$arParams["AUTH"] = StrToUpper($arParams["AUTH"]) == "Y" ? "Y" : "N";
$arParams["EVENT_ID"] = array_key_exists("EVENT_ID", $arParams) && strlen($arParams["EVENT_ID"]) > 0 ? $arParams["EVENT_ID"] : false;
$arParams["LOG_CNT"] = array_key_exists("LOG_CNT", $arParams) && intval($arParams["LOG_CNT"]) > 0 ? $arParams["LOG_CNT"] : 0;
if ($arParams["USER_ID"] <= 0) {
    ShowError(GetMessage("SONET_ACTIVITY_NO_USER"));
    return;
}
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
$dbUser = CUser::GetByID($arParams["USER_ID"]);
if ($arUser = $dbUser->Fetch()) {
    $canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUser["ID"], "viewprofile", $bCurrentUserIsAdmin);
    if ($canViewProfile) {
        $arResult["Features"] = array("all", "system", "system_groups");
        if (CSocnetUser::IsFriendsAllowed()) {
            $arResult["Features"][] = "system_friends";
        }
        if (IsModuleInstalled("forum")) {
            $arResult["Features"][] = "forum";
        }
        if (IsModuleInstalled("blog")) {
            $arResult["Features"][] = "blog";
        }
        if (IsModuleInstalled("photogallery")) {
            $arResult["Features"][] = "photo";
        }
        if (IsModuleInstalled("intranet")) {
            $arResult["Features"][] = "calendar";
            $arResult["Features"][] = "tasks";
        }
Example #6
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$arComponentProps = CComponentUtil::GetComponentProps("bitrix:socialnetwork.activity", $arCurrentValues);
$arEventID = array("" => GetMessage("GD_ACTIVITY_P_EVENT_ID_VALUE_ALL"), "system" => GetMessage("GD_ACTIVITY_P_EVENT_ID_VALUE_SYSTEM"), "system_groups" => GetMessage("GD_ACTIVITY_P_EVENT_ID_VALUE_SYSTEM_GROUPS"));
if (CModule::IncludeModule("socialnetwork") && CSocnetUser::IsFriendsAllowed()) {
    $arEventID["system_friends"] = GetMessage("GD_ACTIVITY_P_EVENT_ID_VALUE_SYSTEM_FRIENDS");
}
if (IsModuleInstalled("forum")) {
    $arEventID["forum"] = GetMessage("GD_ACTIVITY_P_EVENT_ID_VALUE_FORUM");
}
if (IsModuleInstalled("blog")) {
    $arEventID["blog"] = GetMessage("GD_ACTIVITY_P_EVENT_ID_VALUE_BLOG");
}
if (IsModuleInstalled("photogallery")) {
    $arEventID["photo"] = GetMessage("GD_ACTIVITY_P_EVENT_ID_VALUE_PHOTO");
}
if (IsModuleInstalled("intranet")) {
    $arEventID["calendar"] = GetMessage("GD_ACTIVITY_P_EVENT_ID_VALUE_CALENDAR");
    $arEventID["tasks"] = GetMessage("GD_ACTIVITY_P_EVENT_ID_VALUE_TASKS");
}
if (IsModuleInstalled("webdav")) {
    $arEventID["files"] = GetMessage("GD_ACTIVITY_P_EVENT_ID_VALUE_FILES");
}
$arParameters = array("USER_PARAMETERS" => array("LOG_DATE_DAYS" => $arComponentProps["PARAMETERS"]["LOG_DATE_DAYS"], "LOG_CNT" => array("NAME" => GetMessage("GD_ACTIVITY_P_LOG_CNT"), "TYPE" => "STRING", "DEFAULT" => "7"), "EVENT_ID" => array("NAME" => GetMessage("GD_ACTIVITY_P_EVENT_ID"), "TYPE" => "LIST", "VALUES" => $arEventID, "MULTIPLE" => "N", "DEFAULT" => "")));