当前位置: 首页>>代码示例>>PHP>>正文


PHP CAccess::GetUserCodesArray方法代码示例

本文整理汇总了PHP中CAccess::GetUserCodesArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CAccess::GetUserCodesArray方法的具体用法?PHP CAccess::GetUserCodesArray怎么用?PHP CAccess::GetUserCodesArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAccess的用法示例。


在下文中一共展示了CAccess::GetUserCodesArray方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetSocNetUserPerms

 function GetSocNetUserPerms($postId = 0, $authorId = 0)
 {
     global $APPLICATION, $USER, $AR_BLOG_PERMS;
     $userId = IntVal($USER->GetID());
     $postId = IntVal($postId);
     $authorId = IntVal($authorId);
     if ($postId <= 0) {
         return false;
     }
     $perms = BLOG_PERMS_DENY;
     $blogModulePermissions = $APPLICATION->GetGroupRight("blog");
     if ($authorId > 0 && $userId == $authorId) {
         $perms = BLOG_PERMS_FULL;
     } elseif ($blogModulePermissions >= "W" || CSocNetUser::IsCurrentUserModuleAdmin()) {
         end($AR_BLOG_PERMS);
         $perms = key($AR_BLOG_PERMS);
         reset($AR_BLOG_PERMS);
     }
     if ($perms <= BLOG_PERMS_DENY) {
         $arPerms = CBlogPost::GetSocNetPerms($postId);
         $arEntities = array();
         if (!empty(CBlogPost::$arUACCache[$userId])) {
             $arEntities = CBlogPost::$arUACCache[$userId];
         } else {
             $arCodes = CAccess::GetUserCodesArray($userId);
             foreach ($arCodes as $code) {
                 if (preg_match('/^DR([0-9]+)/', $code, $match) || preg_match('/^D([0-9]+)/', $code, $match) || preg_match('/^IU([0-9]+)/', $code, $match)) {
                     $arEntities["DR"][$code] = $code;
                 } elseif (preg_match('/^SG([0-9]+)_([A-Z])/', $code, $match)) {
                     $arEntities["SG"][$match[1]][$match[2]] = $match[2];
                 }
             }
             CBlogPost::$arUACCache[$userId] = $arEntities;
         }
         if (!empty($arEntities["DR"]) && !empty($arPerms["DR"])) {
             foreach ($arPerms["DR"] as $id => $val) {
                 if (isset($arEntities["DR"]["DR" . $id])) {
                     $perms = BLOG_PERMS_READ;
                     break;
                 }
             }
         }
         if (!empty($arPerms["U"][$userId]) && in_array("US" . $userId, $arPerms["U"][$userId]) || $authorId > 0 && $userId == $authorId) {
             // if author
             $perms = BLOG_PERMS_FULL;
         } else {
             if ($authorId <= 0) {
                 foreach ($arPerms["U"] as $id => $p) {
                     if (in_array("US" . $id, $p)) {
                         $authorId = $id;
                         break;
                     }
                 }
             }
             if (!empty($arPerms["U"][$userId]) || !empty($arPerms["U"][$authorId]) && in_array("US" . $authorId, $arPerms["U"][$authorId]) || $perms == BLOG_PERMS_READ) {
                 if (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "write_comment")) {
                     $perms = BLOG_PERMS_WRITE;
                 } elseif (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "premoderate_comment")) {
                     $perms = BLOG_PERMS_PREMODERATE;
                 } elseif (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "view_comment")) {
                     $perms = BLOG_PERMS_READ;
                 }
             }
         }
         if ($perms <= BLOG_PERMS_FULL) {
             $arGroupsId = array();
             if (!empty($arPerms["SG"])) {
                 foreach ($arPerms["SG"] as $gid => $val) {
                     //if(!empty($arEntities["SG"][$gid]))
                     $arGroupsId[] = $gid;
                 }
                 $operation = array("full_comment", "moderate_comment", "write_comment", "premoderate_comment");
                 if ($perms < BLOG_PERMS_READ) {
                     $operation[] = "view_comment";
                 }
             }
             if (!empty($arGroupsId)) {
                 foreach ($operation as $v) {
                     if ($perms <= BLOG_PERMS_READ) {
                         $f = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_GROUP, $arGroupsId, "blog", $v);
                         if (!empty($f)) {
                             foreach ($f as $gid => $val) {
                                 if (!empty($arEntities["SG"][$gid]) && in_array($val, $arEntities["SG"][$gid]) || $val == SONET_ROLES_ALL || $userId > 0 && $val == SONET_ROLES_AUTHORIZED) {
                                     switch ($v) {
                                         case "full_comment":
                                             $perms = BLOG_PERMS_FULL;
                                             break;
                                         case "moderate_comment":
                                             $perms = BLOG_PERMS_MODERATE;
                                             break;
                                         case "write_comment":
                                             $perms = BLOG_PERMS_WRITE;
                                             break;
                                         case "premoderate_comment":
                                             $perms = BLOG_PERMS_PREMODERATE;
                                             break;
                                         case "view_comment":
                                             $perms = BLOG_PERMS_READ;
                                             break;
                                     }
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:blog_comment.php

示例2: SearchUsers

    public static function SearchUsers($search, $nameTemplate = "", $bSelf = true, $bEmployeesOnly = false, $bExtranetOnly = false, $departmentId = false)
    {
        CUtil::JSPostUnescape();
        $arUsers = array();
        $search = trim($search);
        if (strlen($search) <= 0 || !GetFilterQuery("TEST", $search)) {
            return $arUsers;
        }
        $bIntranetEnable = IsModuleInstalled('intranet');
        $bExtranetEnable = CModule::IncludeModule('extranet');
        $bBitrix24Enable = IsModuleInstalled('bitrix24');
        $bExtranetUser = $bExtranetEnable && !CExtranet::IsIntranetUser();
        $current_user_id = intval($GLOBALS["USER"]->GetID());
        if ($bExtranetEnable) {
            CSocNetTools::InitGlobalExtranetArrays();
        }
        $arSearchValue = preg_split('/\\s+/', trim(ToUpper($search)));
        array_walk($arSearchValue, array('CSocNetLogDestination', '__percent_walk'));
        $arFilter = array(array('LOGIC' => 'OR', 'NAME' => $arSearchValue, 'LAST_NAME' => $arSearchValue, '%=EMAIL' => $search, '%=LOGIN' => $search), 'ACTIVE' => 'Y');
        if ($bIntranetEnable || COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y") {
            $arFilter["CONFIRM_CODE"] = false;
        }
        if ($bEmployeesOnly || $bBitrix24Enable && !$bExtranetEnable) {
            $arFilter["!UF_DEPARTMENT"] = false;
        } elseif ($bExtranetOnly) {
            $arFilter["UF_DEPARTMENT"] = false;
        }
        if ($bIntranetEnable && $bExtranetEnable && ($bExtranetUser || !$bEmployeesOnly)) {
            $arFilteredUserIDs = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
            if ($bExtranetUser) {
                $arFilter["ID"] = array_merge(array($current_user_id), $arFilteredUserIDs);
            } else {
                $arFilter[] = array('LOGIC' => 'OR', '!UF_DEPARTMENT' => false, 'ID' => array_merge(array($current_user_id), $arFilteredUserIDs));
            }
        }
        $arSelect = array("ID", "NAME", "LAST_NAME", "SECOND_NAME", "EMAIL", "LOGIN", "WORK_POSITION", "PERSONAL_PROFESSION", "PERSONAL_PHOTO", "PERSONAL_GENDER", new \Bitrix\Main\Entity\ExpressionField('MAX_LAST_USE_DATE', 'MAX(%s)', array('\\Bitrix\\Main\\FinderDest:CODE_USER_CURRENT.LAST_USE_DATE')));
        //		$arFilter["\Bitrix\Main\FinderDest:CODE_USER_CURRENT.USER_ID"] = array(false, intval($GLOBALS["USER"]->GetID()));
        $helper = \Bitrix\Main\Application::getConnection()->getSqlHelper();
        $connection = \Bitrix\Main\Application::getConnection();
        $castType = $connection instanceof \Bitrix\Main\DB\MysqlCommonConnection ? 'UNSIGNED' : 'INT';
        $arFilter["@ID"] = new \Bitrix\Main\DB\SqlExpression('
(SELECT
    CAST(' . $helper->quote("MAIN_USER_TMP20258") . '.' . $helper->quote("ID") . ' AS ' . $castType . ') AS ' . $helper->quote("ID") . '
    FROM b_user ' . $helper->quote("MAIN_USER_TMP20258") . '
    LEFT JOIN
    	b_finder_dest ' . $helper->quote("TALIAS_1_TMP20258") . '
    	ON
    		' . $helper->quote("TALIAS_1_TMP20258") . '.' . $helper->quote("CODE_USER_ID") . ' = ' . $helper->quote("MAIN_USER_TMP20258") . '.' . $helper->quote("ID") . '
    		AND ' . $helper->quote("TALIAS_1_TMP20258") . '.' . $helper->quote("USER_ID") . ' = ' . intval($GLOBALS["USER"]->GetID()) . '
    WHERE (
        ' . $helper->quote("TALIAS_1_TMP20258") . '.' . $helper->quote("USER_ID") . ' IS NULL
        or ' . $helper->quote("TALIAS_1_TMP20258") . '.' . $helper->quote("USER_ID") . ' in (0, ' . intval($GLOBALS["USER"]->GetID()) . ')
	)
)');
        $rsUser = \Bitrix\Main\UserTable::getList(array('order' => array("\\Bitrix\\Main\\FinderDest:CODE_USER_CURRENT.LAST_USE_DATE" => 'DESC', 'LAST_NAME' => 'ASC'), 'filter' => $arFilter, 'select' => $arSelect, 'limit' => 50, 'data_doubling' => false));
        while ($arUser = $rsUser->fetch()) {
            if (!$bSelf && $current_user_id == $arUser['ID']) {
                continue;
            }
            if (intval($departmentId) > 0) {
                $arUserGroupCode = CAccess::GetUserCodesArray($arUser["ID"]);
                if (!in_array("DR" . intval($departmentId), $arUserGroupCode)) {
                    continue;
                }
            }
            $sName = CUser::FormatName(empty($nameTemplate) ? CSite::GetNameFormat(false) : $nameTemplate, $arUser, true, true);
            $arFileTmp = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array('width' => 32, 'height' => 32), BX_RESIZE_IMAGE_EXACT, false);
            $arUsers['U' . $arUser["ID"]] = array('id' => 'U' . $arUser["ID"], 'entityId' => $arUser["ID"], 'name' => $sName, 'avatar' => empty($arFileTmp['src']) ? '' : $arFileTmp['src'], 'desc' => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : ($arUser['PERSONAL_PROFESSION'] ? $arUser['PERSONAL_PROFESSION'] : '&nbsp;'), 'isExtranet' => isset($GLOBALS["arExtranetUserID"]) && is_array($GLOBALS["arExtranetUserID"]) && in_array($arUser["ID"], $GLOBALS["arExtranetUserID"]) ? "Y" : "N");
            $checksum = md5(serialize($arUsers['U' . $arUser["ID"]]));
            $arUsers['U' . $arUser["ID"]]['checksum'] = $checksum;
        }
        return $arUsers;
    }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:73,代码来源:log_destination.php

示例3: GetAccessCodes

 function GetAccessCodes()
 {
     if (!$this->IsAuthorized()) {
         return array('G2');
     }
     static $arCodes = array();
     $USER_ID = intval($this->GetID());
     if (!array_key_exists($USER_ID, $arCodes)) {
         $access = new CAccess();
         $access->UpdateCodes();
         $arCodes[$USER_ID] = CAccess::GetUserCodesArray($USER_ID);
         if ($this->IsAuthorized()) {
             $arCodes[$USER_ID][] = "AU";
         }
     }
     return $arCodes[$USER_ID];
 }
开发者ID:nProfessor,项目名称:Mytb,代码行数:17,代码来源:user.php

示例4: ProcessLogEventEditPOST

 public static function ProcessLogEventEditPOST($arPOST, $entityTypeID, $entityID, &$arResult)
 {
     $arEntityData = array();
     $errors = array();
     $enableTitle = isset($arPOST['ENABLE_POST_TITLE']) && strtoupper($arPOST['ENABLE_POST_TITLE']) === 'Y';
     $title = $enableTitle && isset($arPOST['POST_TITLE']) ? $arPOST['POST_TITLE'] : '';
     $message = isset($arPOST['MESSAGE']) ? htmlspecialcharsback($arPOST['MESSAGE']) : '';
     $arResult['EVENT']['MESSAGE'] = $message;
     $arResult['EVENT']['TITLE'] = $title;
     $arResult['ENABLE_TITLE'] = $enableTitle;
     $attachedFiles = array();
     $webDavFileFieldName = $arResult['WEB_DAV_FILE_FIELD_NAME'];
     if ($webDavFileFieldName !== '' && isset($GLOBALS[$webDavFileFieldName]) && is_array($GLOBALS[$webDavFileFieldName])) {
         foreach ($GLOBALS[$webDavFileFieldName] as $fileID) {
             if ($fileID === '') {
                 continue;
             }
             //fileID:  "888|165|16"
             $attachedFiles[] = $fileID;
         }
         if (!empty($attachedFiles) && is_array($arResult['WEB_DAV_FILE_FIELD'])) {
             $arResult['WEB_DAV_FILE_FIELD']['VALUE'] = $attachedFiles;
         }
     }
     $allowToAll = COption::GetOptionString('socialnetwork', 'allow_livefeed_toall', 'Y') === 'Y';
     if ($allowToAll) {
         $arToAllRights = unserialize(COption::GetOptionString("socialnetwork", "livefeed_toall_rights", 'a:1:{i:0;s:2:"AU";}'));
         if (!$arToAllRights) {
             $arToAllRights = array('AU');
         }
         $arUserGroupCode = array_merge(array('AU'), CAccess::GetUserCodesArray($arResult['USER_ID']));
         if (count(array_intersect($arToAllRights, $arUserGroupCode)) <= 0) {
             $allowToAll = false;
         }
     }
     $arSocnetRights = array();
     if (!empty($arPOST['SPERM'])) {
         foreach ($arPOST['SPERM'] as $v => $k) {
             if (strlen($v) > 0 && is_array($k) && !empty($k)) {
                 foreach ($k as $vv) {
                     if (strlen($vv) > 0) {
                         $arSocnetRights[] = $vv;
                     }
                 }
             }
         }
     }
     if (in_array('UA', $arSocnetRights) && !$allowToAll) {
         foreach ($arSocnetRights as $key => $value) {
             if ($value == 'UA') {
                 unset($arSocnetRights[$key]);
                 break;
             }
         }
     }
     foreach ($arSocnetRights as $key => $value) {
         if ($value == 'UA') {
             $arSocnetRights[] = 'AU';
             unset($arSocnetRights[$key]);
             break;
         }
     }
     $arSocnetRights = array_unique($arSocnetRights);
     $allFeedEtityTypes = CCrmLiveFeedEntity::GetAll();
     $userPerms = CCrmPerms::GetCurrentUserPermissions();
     foreach ($arSocnetRights as $key => $value) {
         $groupCodeData = array();
         if (CCrmLiveFeed::TryParseGroupCode($value, $groupCodeData) && in_array($groupCodeData['ENTITY_TYPE'], $allFeedEtityTypes, true)) {
             $groupCodeEntityType = $groupCodeData['ENTITY_TYPE'];
             $groupCodeEntityID = $groupCodeData['ENTITY_ID'];
             if (!CCrmLiveFeed::CheckCreatePermission($groupCodeEntityType, $groupCodeEntityID, $userPerms)) {
                 $canonicalEntityTypeID = CCrmLiveFeedEntity::ResolveEntityTypeID($groupCodeEntityType);
                 $errors[] = GetMessage('CRM_SL_EVENT_EDIT_PERMISSION_DENIED', array('#TITLE#' => CCrmOwnerType::GetCaption($canonicalEntityTypeID, $groupCodeEntityID, false)));
             } else {
                 $arEntityData[] = array('ENTITY_TYPE' => $groupCodeEntityType, 'ENTITY_ID' => $groupCodeEntityID);
             }
         }
     }
     if (!(CCrmOwnerType::IsDefined($entityTypeID) && $entityID > 0) && !empty($arEntityData)) {
         $entityData = $arEntityData[0];
         $entityTypeID = CCrmLiveFeedEntity::ResolveEntityTypeID($entityData['ENTITY_TYPE']);
         $entityID = $entityData['ENTITY_ID'];
     }
     if (!empty($arEntityData)) {
         $arResult['ENTITY_DATA'] = $arEntityData;
     }
     if (!(CCrmOwnerType::IsDefined($entityTypeID) && $entityID > 0)) {
         $errors[] = GetMessage('CRM_SL_EVENT_EDIT_ENTITY_NOT_DEFINED');
     }
     if ($message === '') {
         $errors[] = GetMessage('CRM_SL_EVENT_EDIT_EMPTY_MESSAGE');
     }
     if (empty($errors)) {
         $fields = array('ENTITY_TYPE_ID' => $entityTypeID, 'ENTITY_ID' => $entityID, 'USER_ID' => $arResult['USER_ID'], 'TITLE' => $title, 'MESSAGE' => $message, 'RIGHTS' => $arSocnetRights);
         $parents = array();
         CCrmOwnerType::TryGetOwnerInfos($entityTypeID, $entityID, $parents, array('ENABLE_MAPPING' => true));
         foreach ($arEntityData as $entityData) {
             $curEntityTypeID = CCrmLiveFeedEntity::ResolveEntityTypeID($entityData['ENTITY_TYPE']);
             $curEntityID = $entityData['ENTITY_ID'];
             $entityKey = "{$curEntityTypeID}_{$curEntityID}";
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:livefeed.php

示例5: SearchUsers

 public static function SearchUsers($search, $nameTemplate = "", $bSelf = true, $bEmployeesOnly = false, $bExtranetOnly = false, $departmentId = false)
 {
     CUtil::JSPostUnescape();
     $arUsers = array();
     $search = trim($search);
     if (strlen($search) <= 0 || !GetFilterQuery("TEST", $search)) {
         return $arUsers;
     }
     $bIntranetEnable = IsModuleInstalled('intranet');
     $bExtranetEnable = CModule::IncludeModule('extranet');
     $bBitrix24Enable = IsModuleInstalled('bitrix24');
     $bExtranetUser = $bExtranetEnable && !CExtranet::IsIntranetUser();
     $current_user_id = intval($GLOBALS["USER"]->GetID());
     if ($bExtranetEnable) {
         CSocNetTools::InitGlobalExtranetArrays();
     }
     $arSearchValue = preg_split('/\\s+/', trim($search));
     array_walk($arSearchValue, array('CSocNetLogDestination', '__percent_walk'));
     $arFilter = array(array('LOGIC' => 'OR', '%=NAME' => $arSearchValue, '%=LAST_NAME' => $arSearchValue, '%=EMAIL' => $search, '%=LOGIN' => $search), 'ACTIVE' => 'Y');
     if ($bIntranetEnable || COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y") {
         $arFilter["CONFIRM_CODE"] = false;
     }
     if ($bEmployeesOnly || $bBitrix24Enable && !$bExtranetEnable) {
         $arFilter["!UF_DEPARTMENT"] = false;
     } elseif ($bExtranetOnly) {
         $arFilter["UF_DEPARTMENT"] = false;
     }
     if ($bIntranetEnable && $bExtranetEnable && ($bExtranetUser || !$bEmployeesOnly)) {
         $arFilteredUserIDs = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
         if ($bExtranetUser) {
             $arFilter["ID"] = array_merge(array($current_user_id), $arFilteredUserIDs);
         } else {
             $arFilter[] = array('LOGIC' => 'OR', '!UF_DEPARTMENT' => false, 'ID' => array_merge(array($current_user_id), $arFilteredUserIDs));
         }
     }
     $arSelect = array("ID", "NAME", "LAST_NAME", "SECOND_NAME", "EMAIL", "LOGIN", "WORK_POSITION", "PERSONAL_PROFESSION", "PERSONAL_PHOTO", "PERSONAL_GENDER");
     if ($bIntranetEnable) {
         $arSelect[] = 'UF_DEPARTMENT';
     }
     if (intval($departmentId) > 0) {
         $acc = new CAccess();
     }
     $rsUser = \Bitrix\Main\UserTable::getList(array('order' => array('LAST_NAME' => 'ASC'), 'filter' => $arFilter, 'select' => $arSelect, 'limit' => 20, 'data_doubling' => false));
     while ($arUser = $rsUser->fetch()) {
         if (!$bSelf && $current_user_id == $arUser['ID']) {
             continue;
         }
         if (is_object($acc)) {
             $acc->UpdateCodes(array("USER_ID" => $arUser["ID"]));
             $arUserGroupCode = CAccess::GetUserCodesArray($arUser["ID"], array("PROVIDER_ID" => "intranet"));
             if (!in_array("DR" . intval($departmentId), $arUserGroupCode)) {
                 continue;
             }
         }
         $sName = CUser::FormatName(empty($nameTemplate) ? CSite::GetNameFormat(false) : $nameTemplate, $arUser, true, true);
         $arFileTmp = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array('width' => 32, 'height' => 32), BX_RESIZE_IMAGE_EXACT, false);
         $arUsers['U' . $arUser["ID"]] = array('id' => 'U' . $arUser["ID"], 'entityId' => $arUser["ID"], 'name' => $sName, 'avatar' => empty($arFileTmp['src']) ? '' : $arFileTmp['src'], 'desc' => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : ($arUser['PERSONAL_PROFESSION'] ? $arUser['PERSONAL_PROFESSION'] : '&nbsp;'), 'isExtranet' => isset($GLOBALS["arExtranetUserID"]) && is_array($GLOBALS["arExtranetUserID"]) && in_array($arUser["ID"], $GLOBALS["arExtranetUserID"]) ? "Y" : "N");
         $checksum = md5(serialize($arUsers['U' . $arUser["ID"]]));
         $arUsers['U' . $arUser["ID"]]['checksum'] = $checksum;
     }
     return $arUsers;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:62,代码来源:log_destination.php

示例6: array

         if (is_array($arResult["DEST_USERS_LAST"]) && !empty($arResult["DEST_USERS_LAST"])) {
             $arLastUserID = array();
             foreach ($arResult["DEST_USERS_LAST"] as $user_code) {
                 if (preg_match('/^U(\\d+)$/', $user_code, $match)) {
                     $arLastUserID[] = $match[1];
                 }
             }
             $dbUsers = CUser::GetList($sort_by = array('last_name' => 'asc', 'IS_ONLINE' => 'desc'), $dummy = '', array("ID" => implode("|", $arLastUserID)), array("FIELDS" => array("ID", "LAST_NAME", "NAME", "SECOND_NAME", "LOGIN", "PERSONAL_PHOTO", "WORK_POSITION", "PERSONAL_PROFESSION"), "SELECT" => array("UF_DEPARTMENT")));
             $arResult["siteDepartmentID"] = COption::GetOptionString("main", "wizard_departament", false, SITE_ID, true);
             if (intval($arResult["siteDepartmentID"]) > 0) {
                 $acc = new CAccess();
             }
             while ($arUser = $dbUsers->Fetch()) {
                 if (is_object($acc)) {
                     $acc->UpdateCodes(array("USER_ID" => $arUser["ID"]));
                     $arUserGroupCode = CAccess::GetUserCodesArray($arUser["ID"], array("PROVIDER_ID" => "intranet"));
                     if (!in_array("DR" . intval($arResult["siteDepartmentID"]), $arUserGroupCode)) {
                         continue;
                     }
                 }
                 $arFileTmp = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array('width' => 32, 'height' => 32), BX_RESIZE_IMAGE_EXACT, false);
                 $arUserTmp = array("id" => "U" . $arUser["ID"], "entityId" => $arUser["ID"], "name" => trim(CUser::FormatName(empty($arParams["NAME_TEMPLATE"]) ? CSite::GetNameFormat(false) : $arParams["NAME_TEMPLATE"], $arUser)), "avatar" => empty($arFileTmp['src']) ? '' : $arFileTmp['src'], "desc" => $arUser["WORK_POSITION"] ? $arUser["WORK_POSITION"] : ($arUser["PERSONAL_PROFESSION"] ? $arUser["PERSONAL_PROFESSION"] : "&nbsp;"));
                 $key = !$arResult["bExtranetInstalled"] ? "USERS_FOR_JS" : (empty($arUser["UF_DEPARTMENT"]) || is_array($arUser["UF_DEPARTMENT"]) && intval($arUser["UF_DEPARTMENT"][0]) <= 0 ? "USERS_FOR_JS_E" : "USERS_FOR_JS_I");
                 if (!array_key_exists("U" . $arUser["ID"], $arResult["POST"][$key])) {
                     $arResult["POST"][$key]["U" . $arUser["ID"]] = $arUserTmp;
                 }
             }
         }
     }
     $arResult["arSocNetFeaturesSettings"] = CSocNetAllowed::GetAllowedFeatures();
 }
开发者ID:vim84,项目名称:b-markt,代码行数:31,代码来源:component.php

示例7: array

            $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group_" . $val["entityId"]);
        }
        $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_user2group_U" . $user_id);
        $GLOBALS["CACHE_MANAGER"]->EndTagCache();
    }
    $obCache->EndDataCache($arResult["FEED_DESTINATION"]['SONETGROUPS']);
}
$arDestUser = array();
$arResult["FEED_DESTINATION"]['SELECTED'] = array();
$bAllowToAll = COption::GetOptionString("socialnetwork", "allow_livefeed_toall", "Y") == "Y";
if ($bAllowToAll) {
    $arToAllRights = unserialize(COption::GetOptionString("socialnetwork", "livefeed_toall_rights", 'a:1:{i:0;s:2:"AU";}'));
    if (!$arToAllRights) {
        $arToAllRights = array("AU");
    }
    $arUserGroupCode = array_merge(array("AU"), CAccess::GetUserCodesArray($GLOBALS["USER"]->GetID()));
    if (count(array_intersect($arToAllRights, $arUserGroupCode)) <= 0) {
        $bAllowToAll = false;
    }
}
if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser()) {
    if (!empty($arResult["FEED_DESTINATION"]['LAST']['SONETGROUPS'])) {
        foreach ($arResult["FEED_DESTINATION"]['LAST']['SONETGROUPS'] as $val) {
            $arResult["FEED_DESTINATION"]['SELECTED'][$val] = "sonetgroups";
        }
    } else {
        foreach ($arResult["FEED_DESTINATION"]['SONETGROUPS'] as $k => $val) {
            $arResult["FEED_DESTINATION"]['SELECTED'][$k] = "sonetgroups";
        }
    }
} elseif ($bAllowToAll) {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:destination.php

示例8: array

         CSocNetLogDestination::fillLastDestination($arResult["DEST_SORT"], $arResult["DEST_USERS_LAST"]);
         if (isset($arResult["DEST_USERS_LAST"]['USERS'])) {
             $arResult["DEST_USERS_LAST"] = $arResult["DEST_USERS_LAST"]['USERS'];
         }
         if (is_array($arResult["DEST_USERS_LAST"]) && !empty($arResult["DEST_USERS_LAST"])) {
             $arLastUserID = array();
             foreach ($arResult["DEST_USERS_LAST"] as $user_code) {
                 if (preg_match('/^U(\\d+)$/', $user_code, $match)) {
                     $arLastUserID[] = $match[1];
                 }
             }
             $dbUsers = CUser::GetList($sort_by = array('last_name' => 'asc', 'IS_ONLINE' => 'desc'), $dummy = '', array("ID" => implode("|", $arLastUserID)), array("FIELDS" => array("ID", "LAST_NAME", "NAME", "SECOND_NAME", "LOGIN", "PERSONAL_PHOTO", "WORK_POSITION", "PERSONAL_PROFESSION"), "SELECT" => array("UF_DEPARTMENT")));
             $arResult["siteDepartmentID"] = COption::GetOptionString("main", "wizard_departament", false, SITE_ID, true);
             while ($arUser = $dbUsers->Fetch()) {
                 if (intval($arResult["siteDepartmentID"]) > 0) {
                     $arUserGroupCode = CAccess::GetUserCodesArray($arUser["ID"]);
                     if (!in_array("DR" . intval($arResult["siteDepartmentID"]), $arUserGroupCode)) {
                         continue;
                     }
                 }
                 $arFileTmp = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array('width' => 32, 'height' => 32), BX_RESIZE_IMAGE_EXACT, false);
                 $arUserTmp = array("id" => "U" . $arUser["ID"], "entityId" => $arUser["ID"], "name" => trim(CUser::FormatName(empty($arParams["NAME_TEMPLATE"]) ? CSite::GetNameFormat(false) : $arParams["NAME_TEMPLATE"], $arUser)), "avatar" => empty($arFileTmp['src']) ? '' : $arFileTmp['src'], "desc" => $arUser["WORK_POSITION"] ? $arUser["WORK_POSITION"] : ($arUser["PERSONAL_PROFESSION"] ? $arUser["PERSONAL_PROFESSION"] : "&nbsp;"));
                 $key = !$arResult["bExtranetInstalled"] ? "USERS_FOR_JS" : (empty($arUser["UF_DEPARTMENT"]) || is_array($arUser["UF_DEPARTMENT"]) && intval($arUser["UF_DEPARTMENT"][0]) <= 0 ? "USERS_FOR_JS_E" : "USERS_FOR_JS_I");
                 if (!array_key_exists("U" . $arUser["ID"], $arResult["POST"][$key])) {
                     $arResult["POST"][$key]["U" . $arUser["ID"]] = $arUserTmp;
                 }
             }
         }
     }
     $arResult["arSocNetFeaturesSettings"] = CSocNetAllowed::GetAllowedFeatures();
 }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例9: GetSocNetPostPerms

 function GetSocNetPostPerms($postId = 0, $bNeedFull = false, $userId = false, $postAuthor = 0)
 {
     if (!$userId) {
         $userId = IntVal($GLOBALS["USER"]->GetID());
         $bByUserId = false;
     } else {
         $userId = IntVal($userId);
         $bByUserId = true;
     }
     $postId = IntVal($postId);
     if ($postId <= 0) {
         return false;
     }
     $cId = md5(serialize(func_get_args()));
     if (isset($GLOBALS["BLOG_BP_SOCNETPOSTPERMS"]) && !empty($GLOBALS["BLOG_BP_SOCNETPOSTPERMS"][$cId])) {
         return $GLOBALS["BLOG_BP_SOCNETPOSTPERMS"][$cId];
     }
     if (!CModule::IncludeModule("socialnetwork")) {
         return false;
     }
     $perms = BLOG_PERMS_DENY;
     $arAvailPerms = array_keys($GLOBALS["AR_BLOG_PERMS"]);
     if (!$bByUserId) {
         $blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
         if ($blogModulePermissions >= "W" || CSocNetUser::IsCurrentUserModuleAdmin()) {
             $perms = $arAvailPerms[count($arAvailPerms) - 1];
         }
     } else {
         if (CSocNetUser::IsUserModuleAdmin($userId)) {
             $perms = $arAvailPerms[count($arAvailPerms) - 1];
         }
     }
     if (IntVal($postAuthor) <= 0) {
         $dbPost = CBlogPost::GetList(array(), array("ID" => $postId), false, false, array("ID", "AUTHOR_ID"));
         $arPost = $dbPost->Fetch();
     } else {
         $arPost["AUTHOR_ID"] = $postAuthor;
     }
     if ($arPost["AUTHOR_ID"] == $userId) {
         $perms = BLOG_PERMS_FULL;
     }
     if ($perms <= BLOG_PERMS_DENY) {
         $arPerms = CBlogPost::GetSocNetPerms($postId);
         $arEntities = array();
         if (isset($GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId]) && !empty($GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId])) {
             $arEntities = $GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId];
         } else {
             $arCodes = CAccess::GetUserCodesArray($userId);
             foreach ($arCodes as $code) {
                 if (preg_match('/^DR([0-9]+)/', $code, $match) || preg_match('/^D([0-9]+)/', $code, $match) || preg_match('/^IU([0-9]+)/', $code, $match)) {
                     $arEntities["DR"][$code] = $code;
                 } elseif (preg_match('/^SG([0-9]+)_([A-Z])/', $code, $match)) {
                     $arEntities["SG"][$match[1]][$match[2]] = $match[2];
                 }
             }
             $GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId] = $arEntities;
         }
         foreach ($arPerms as $t => $val) {
             foreach ($val as $id => $p) {
                 if (!is_array($p)) {
                     $p = array();
                 }
                 if ($userId > 0 && $t == "U" && $userId == $id) {
                     $perms = BLOG_PERMS_READ;
                     if (in_array("US" . $userId, $p)) {
                         // if author
                         $perms = BLOG_PERMS_FULL;
                     }
                     break;
                 }
                 if (in_array("G2", $p)) {
                     $perms = BLOG_PERMS_READ;
                     break;
                 }
                 if ($userId > 0 && in_array("AU", $p)) {
                     $perms = BLOG_PERMS_READ;
                     break;
                 }
                 if ($t == "SG") {
                     if (!empty($arEntities["SG"][$id])) {
                         foreach ($arEntities["SG"][$id] as $gr) {
                             if (in_array("SG" . $id . "_" . $gr, $p)) {
                                 $perms = BLOG_PERMS_READ;
                                 break;
                             }
                         }
                     }
                 }
                 if ($t == "DR" && !empty($arEntities["DR"])) {
                     if (in_array("DR" . $id, $arEntities["DR"])) {
                         $perms = BLOG_PERMS_READ;
                         break;
                     }
                 }
             }
             if ($perms > BLOG_PERMS_DENY) {
                 break;
             }
         }
         if ($bNeedFull && $perms <= BLOG_PERMS_FULL) {
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:blog_post.php


注:本文中的CAccess::GetUserCodesArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。