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


PHP CForumNew::getUserPermission方法代码示例

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


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

示例1: canRead


//.........这里部分代码省略.........
                         while ($res = $db_res->fetch()) {
                             $codes[] = $res["GROUP_CODE"];
                         }
                     }
                     $this->canRead = $this->canAccess($userId, $codes);
                     return $this->canRead;
                 }
                 $this->canRead = true;
                 return $this->canRead;
             case "MEETING":
                 $this->canRead = (int) $message["FORUM_ID"] == (int) \COption::getOptionInt('meeting', 'comments_forum_id', 0, SITE_ID);
                 return $this->canRead;
             case "TIMEMAN_ENTRY":
                 if (Loader::includeModule("timeman")) {
                     $dbEntry = \CTimeManEntry::getList(array(), array("ID" => $entityId), false, false, array("ID", "USER_ID"));
                     if ($arEntry = $dbEntry->fetch()) {
                         if ($arEntry["USER_ID"] == $userId) {
                             $this->canRead = true;
                             return $this->canRead;
                         } else {
                             $arManagers = \CTimeMan::getUserManagers($arEntry["USER_ID"]);
                             $this->canRead = in_array($userId, $arManagers);
                             return $this->canRead;
                         }
                     }
                 }
                 $this->canRead = false;
                 return $this->canRead;
             case "TIMEMAN_REPORT":
                 if (Loader::includeModule("timeman")) {
                     $dbReport = \CTimeManReportFull::getList(array(), array("ID" => $entityId), array("ID", "USER_ID"));
                     if ($arReport = $dbReport->fetch()) {
                         if ($arReport["USER_ID"] == $userId) {
                             $this->canRead = true;
                             return $this->canRead;
                         } else {
                             $arManagers = \CTimeMan::getUserManagers($arReport["USER_ID"]);
                             $this->canRead = in_array($userId, $arManagers);
                             return $this->canRead;
                         }
                     }
                 }
                 $this->canRead = false;
                 return $this->canRead;
             case "WF":
                 $this->canRead = false;
                 if (Loader::includeModule("bizproc")) {
                     $currentUserId = (int) $this->getUser()->getId();
                     $participants = \CBPTaskService::getWorkflowParticipants($entityId);
                     if (in_array($currentUserId, $participants)) {
                         $this->canRead = true;
                     } else {
                         $state = \CBPStateService::getWorkflowStateInfo($entityId);
                         if ($state && $currentUserId === (int) $state['STARTED_BY']) {
                             $this->canRead = true;
                         }
                     }
                 }
                 return $this->canRead;
         }
         if ((!empty($topic["SOCNET_GROUP_ID"]) || !empty($topic["OWNER_ID"])) && Loader::includeModule("socialnetwork")) {
             if (!empty($topic["SOCNET_GROUP_ID"])) {
                 $this->canRead = \CSocNetFeatures::isActiveFeature(SONET_ENTITY_GROUP, $topic["SOCNET_GROUP_ID"], "forum") && \CSocNetFeaturesPerms::canPerformOperation($userId, SONET_ENTITY_GROUP, $topic["SOCNET_GROUP_ID"], "forum", "view");
                 return $this->canRead;
             } else {
                 $this->canRead = \CSocNetFeatures::isActiveFeature(SONET_ENTITY_USER, $topic["OWNER_ID"], "forum") && \CSocNetFeaturesPerms::canPerformOperation($userId, SONET_ENTITY_USER, $topic["OWNER_ID"], "forum", "view");
                 return $this->canRead;
             }
         }
         if ($message) {
             $user = $this->getUser();
             if ($user && $userId == $user->getId()) {
                 $userGroups = $user->getUserGroupArray();
             } else {
                 $userGroups = array(2);
             }
             /** @noinspection PhpDynamicAsStaticMethodCallInspection */
             if (\CForumUser::isAdmin($userId, $userGroups)) {
                 $this->canRead = true;
                 return $this->canRead;
             }
             /** @noinspection PhpDynamicAsStaticMethodCallInspection */
             $perms = \CForumNew::getUserPermission($message["FORUM_ID"], $userGroups);
             if ($perms >= "Y") {
                 $this->canRead = true;
                 return $this->canRead;
             }
             if ($perms < "E" || $perms < "Q" && $message["APPROVED"] != "Y") {
                 $this->canRead = false;
                 return $this->canRead;
             }
             /** @noinspection PhpDynamicAsStaticMethodCallInspection */
             $forum = \CForumNew::getByID($message["FORUM_ID"]);
             $this->canRead = $forum["ACTIVE"] == "Y";
             return $this->canRead;
         }
     }
     $this->canRead = false;
     return $this->canRead;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:forummessageconnector.php


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