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


PHP CSocNetUserToGroup::GetUserRole方法代码示例

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


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

示例1: _socnet_type_check

 protected static function _socnet_type_check($USER, $iblock_type_id, $socnet_group_id)
 {
     if ($iblock_type_id === COption::GetOptionString("lists", "socnet_iblock_type_id")) {
         $socnet_role = CSocNetUserToGroup::GetUserRole($USER->GetID(), $socnet_group_id);
         if ($socnet_role == "A") {
             return CListPermissions::IS_ADMIN;
         } else {
             return CListPermissions::CAN_READ;
         }
     } else {
         return CListPermissions::WRONG_IBLOCK_TYPE;
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:13,代码来源:listperm.php

示例2: CanUserReadGroup

 function CanUserReadGroup($userID, $groupID)
 {
     $userID = IntVal($userID);
     $groupID = IntVal($groupID);
     if ($groupID <= 0) {
         return false;
     }
     $arGroup = CSocNetGroup::GetById($groupID);
     if ($arGroup == false) {
         return false;
     }
     if ($arGroup["OPENED"] == "Y") {
         return true;
     }
     $userRoleInGroup = CSocNetUserToGroup::GetUserRole($userID, $groupID);
     if ($userRoleInGroup == false) {
         return false;
     }
     if ($userRoleInGroup == SONET_ROLES_MODERATOR || $userRoleInGroup == SONET_ROLES_OWNER || $userRoleInGroup == SONET_ROLES_USER) {
         return true;
     } else {
         return false;
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:25,代码来源:group.php

示例3: tasksTaskEditAjaxHandler

function tasksTaskEditAjaxHandler()
{
    global $DB;
    if (isset($_POST['NAME_TEMPLATE'])) {
        $nameTemplate = $_POST['NAME_TEMPLATE'];
    } else {
        $nameTemplate = CSite::getNameFormat(false);
    }
    if (!check_bitrix_sessid()) {
        die;
    }
    switch ($_POST['action']) {
        case 'tasks_isUserMemberOfGroup':
            if (!CModule::IncludeModule('socialnetwork')) {
                throw new Exception($_POST['action'] . ': socialnetwork module failed to load.');
            }
            if (!isset($_POST['groupId']) || !isset($_POST['userId']) || $_POST['groupId'] < 0 || $_POST['userId'] < 0) {
                throw new Exception($_POST['action'] . ': invalid userId or groupId');
            }
            $rc = CSocNetUserToGroup::GetUserRole((int) $_POST['userId'], (int) $_POST['groupId']);
            if ($rc === false || $rc == SONET_ROLES_REQUEST) {
                echo 'N';
            } else {
                echo 'Y';
            }
            break;
        case 'getWarnings':
            if (isset($_POST['TASK']['RESPONSIBLE_ID'])) {
                $responsibleId = (int) $_POST['TASK']['RESPONSIBLE_ID'];
                $responsibleName = '#unknown user#';
                $rsUser = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => $responsibleId), array('FIELDS' => array('NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN')));
                if ($arUser = $rsUser->fetch()) {
                    $responsibleName = CUser::FormatName($nameTemplate, array("NAME" => $arUser["NAME"], "LAST_NAME" => $arUser["LAST_NAME"], "SECOND_NAME" => $arUser["SECOND_NAME"], "LOGIN" => $arUser["LOGIN"]), true, false);
                }
                if (isset($_POST['TASK']['GROUP_ID']) && $_POST['TASK']['GROUP_ID']) {
                    if (CModule::IncludeModule('socialnetwork')) {
                        $rc = CSocNetUserToGroup::GetUserRole($responsibleId, (int) $_POST['TASK']['GROUP_ID']);
                        if ($rc === false || $rc == SONET_ROLES_REQUEST) {
                            $arGroup = CSocNetGroup::GetByID($_POST['TASK']['GROUP_ID']);
                            echo '<div>' . htmlspecialcharsbx(str_replace(array('#FORMATTED_USER_NAME#', '#GROUP_NAME#'), array($responsibleName, $arGroup["NAME"]), GetMessage('TASKS_WARNING_RESPONSIBLE_NOT_IN_TASK_GROUP'))) . "</div>\n";
                        }
                    }
                }
                if (CModule::IncludeModule('intranet')) {
                    $dt = ConvertTimeStamp(false, 'SHORT');
                    $arAbsenceData = CIntranetUtils::GetAbsenceData(array('USERS' => array($responsibleId), 'DATE_START' => $dt, 'DATE_FINISH' => $dt, 'PER_USER' => false), $MODE = BX_INTRANET_ABSENCE_ALL);
                    $curTs = MakeTimeStamp(ConvertTimeStamp(false, 'FULL'));
                    if (isset($arAbsenceData[0])) {
                        if (array_key_exists('DATE_ACTIVE_FROM', $arAbsenceData[0]) && array_key_exists('DATE_ACTIVE_TO', $arAbsenceData[0])) {
                            $fromTs = MakeTimeStamp($arAbsenceData[0]['DATE_ACTIVE_FROM']);
                            $toTs = MakeTimeStamp($arAbsenceData[0]['DATE_ACTIVE_TO']);
                        } else {
                            $fromTs = MakeTimeStamp($arAbsenceData[0]['DATE_FROM']);
                            $toTs = MakeTimeStamp($arAbsenceData[0]['DATE_TO']);
                        }
                        if ($toTs > $curTs) {
                            $from = FormatDate($DB->DateFormatToPhp(CSite::GetDateFormat(CIntranetUtils::IsDateTime($fromTs) ? 'FULL' : 'SHORT')), $fromTs);
                            $to = FormatDate($DB->DateFormatToPhp(CSite::GetDateFormat(CIntranetUtils::IsDateTime($toTs) ? 'FULL' : 'SHORT')), $toTs);
                            echo '<div>' . htmlspecialcharsbx(str_replace(array('#FORMATTED_USER_NAME#', '#DATE_FROM#', '#DATE_TO#', '#ABSCENCE_REASON#'), array($responsibleName, $from, $to, $arAbsenceData[0]['NAME']), GetMessage('TASKS_WARNING_RESPONSIBLE_IS_ABSENCE'))) . '</div>';
                        }
                    }
                }
            }
            break;
        default:
            throw new Exception('Requested action is unknown!');
            break;
    }
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:69,代码来源:ajax.php

示例4: GetMessage

     $arGroupSites[] = $arGroupSite["LID"];
 }
 if (!in_array(SITE_ID, $arGroupSites)) {
     $arResult["FatalError"] = GetMessage("SONET_P_USER_NO_GROUP");
 } else {
     $arResult["Group"] = $arGroup;
     $arResult["Urls"]["Group"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arResult["Group"]["ID"]));
     $arResult["CurrentUserPerms"] = CSocNetUserToGroup::InitUserPerms($GLOBALS["USER"]->GetID(), $arResult["Group"], CSocNetUser::IsCurrentUserModuleAdmin());
     if (!$arResult["CurrentUserPerms"] || !$arResult["CurrentUserPerms"]["UserCanInitiate"]) {
         $arResult["FatalError"] = GetMessage("SONET_C11_NO_PERMS") . ". ";
     } else {
         $arResult["IsCurrentUser"] = $GLOBALS["USER"]->GetID() == $arResult["User"]["ID"];
         $arResult["CurrentUserRelation"] = CSocNetUserRelations::GetRelation($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"]);
         $arResult["CurrentUserPerms"]["ViewProfile"] = $arResult["IsCurrentUser"] || CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
         $arResult["CurrentUserPerms"]["InviteGroup"] = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"], "invitegroup", CSocNetUser::IsCurrentUserModuleAdmin());
         $user2groupRelation = CSocNetUserToGroup::GetUserRole($arResult["User"]["ID"], $arResult["Group"]["ID"]);
         if ($arResult["IsCurrentUser"]) {
             $arResult["FatalError"] = GetMessage("SONET_C11_ERR_SELF") . ". ";
         } elseif (!$arResult["CurrentUserPerms"]["InviteGroup"]) {
             $arResult["FatalError"] = GetMessage("SONET_C11_BAD_USER") . ". ";
         } elseif ($user2groupRelation) {
             $arResult["FatalError"] = GetMessage("SONET_C11_BAD_RELATION") . ". ";
         } else {
             $arResult["ShowForm"] = "Input";
             if ($_SERVER["REQUEST_METHOD"] == "POST" && strlen($_POST["save"]) > 0 && check_bitrix_sessid()) {
                 $errorMessage = "";
                 if (strlen($_POST["MESSAGE"]) <= 0) {
                     $errorMessage .= GetMessage("SONET_C11_NO_MESSAGE") . ". ";
                 }
                 if (strlen($errorMessage) <= 0 && !CSocNetUserToGroup::SendRequestToJoinGroup($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"], $arResult["Group"]["ID"], $_POST["MESSAGE"]) && ($e = $APPLICATION->GetException())) {
                     $errorMessage .= $e->GetString();
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例5: GetUserGroups

 function GetUserGroups($documentType = null, $documentId = null, $userId = 0)
 {
     $documentType = trim(is_array($documentType) ? $documentType[2] : $documentType);
     if (is_array($documentType)) {
         $documentType = null;
     } else {
         $documentType = $documentType == null || $documentType == '' ? null : $documentType;
     }
     $userId = intVal($userId);
     $documentIdReal = $documentId = is_array($documentId) ? $documentId[2] : $documentId;
     $documentId = intVal($documentId);
     $arParameters = array();
     if ($documentType == null && $documentId <= 0 || $userId <= 0) {
         return false;
     } elseif ($documentType != null) {
         $res = explode("_", $documentType);
         if (count($res) != 4) {
             return false;
         }
         $arParameters = array("IBlockId" => intval($res[1]), "OwnerType" => $res[2], "OwnerId" => intval($res[3]));
     }
     if ($documentId > 0) {
         $db_res = CIBlockElement::GetList(array(), array("ID" => $documentId, "SHOW_NEW" => "Y", "SHOW_HISTORY" => "Y"), false, false, array("ID", "IBLOCK_ID", "CREATED_BY", "IBLOCK_SECTION_ID"));
         if ($db_res && ($arElement = $db_res->Fetch())) {
             $dbSectionsChain = CIBlockSection::GetNavChain($arElement["IBLOCK_ID"], $arElement["IBLOCK_SECTION_ID"]);
             if ($arSect = $dbSectionsChain->Fetch()) {
                 $arParameters["OwnerType"] = intVal($arSect["SOCNET_GROUP_ID"]) > 0 ? "group" : "user";
                 $arParameters["OwnerId"] = intVal($arSect["SOCNET_GROUP_ID"]) > 0 ? $arSect["SOCNET_GROUP_ID"] : $arSect["CREATED_BY"];
                 $arParameters["IBlockId"] = $arElement["IBLOCK_ID"];
                 $arParameters["CreatedBy"] = $arElement["CREATED_BY"];
             }
         }
     }
     $arParameters["UserGroups"] = array();
     if ($arParameters["OwnerType"] == "group") {
         $arParameters["UserGroups"][] = SONET_ROLES_ALL;
         $r = CSocNetUserToGroup::GetUserRole($userId, $arParameters["OwnerId"]);
         if (strlen($r) > 0) {
             $arParameters["UserGroups"][] = $r;
             foreach ($GLOBALS["arSocNetAllowedInitiatePerms"] as $perm) {
                 if ($r < $perm) {
                     $arParameters["UserGroups"][] = $perm;
                 }
             }
         }
     } elseif ($arParameters["OwnerType"] == "user") {
         $arParameters["UserGroups"][] = SONET_RELATIONS_TYPE_ALL;
         if ($arParameters["OwnerId"] == $userId) {
             $arParameters["UserGroups"][] = SONET_RELATIONS_TYPE_NONE;
         }
         if (CSocNetUserRelations::IsFriends($userId, $arParameters["OwnerId"])) {
             $arParameters["UserGroups"][] = SONET_RELATIONS_TYPE_FRIENDS;
         }
     }
     if ($documentIdReal != null && ($documentId <= 0 || $userId > 0 && $userId == $arParameters["CreatedBy"])) {
         $arParameters["UserGroups"][] = "author";
     }
     return $arParameters["UserGroups"];
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:59,代码来源:iblocksocnetbizproc.php

示例6: CanPerformOperation

 function CanPerformOperation($userID, $type, $id, $feature, $operation, $bCurrentUserIsAdmin = false)
 {
     global $arSocNetAllowedEntityTypes;
     $arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
     $userID = IntVal($userID);
     if (is_array($id) && count($id) <= 0 || !is_array($id) && $id <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_EMPTY_ENTITY_ID"), "ERROR_EMPTY_ENTITY_ID");
         return false;
     }
     $type = Trim($type);
     if (StrLen($type) <= 0 || !in_array($type, $arSocNetAllowedEntityTypes)) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_ERROR_NO_ENTITY_TYPE"), "ERROR_EMPTY_TYPE");
         return false;
     }
     $featureOperationPerms = CSocNetFeaturesPerms::GetOperationPerm($type, $id, $feature, $operation);
     if ($type == SONET_ENTITY_GROUP) {
         $bWorkWithClosedGroups = COption::GetOptionString("socialnetwork", "work_with_closed_groups", "N") == "Y";
         if (is_array($id)) {
             $arGroupToGet = array();
             foreach ($id as $group_id) {
                 if ($featureOperationPerms[$group_id] == false) {
                     $arReturn[$group_id] = false;
                 } else {
                     $arGroupToGet[] = $group_id;
                 }
             }
             $userRoleInGroup = CSocNetUserToGroup::GetUserRole($userID, $arGroupToGet);
             $arGroupToGet = array();
             if (is_array($userRoleInGroup)) {
                 foreach ($userRoleInGroup as $group_id => $role) {
                     if ($userRoleInGroup[$group_id] == SONET_ROLES_BAN) {
                         $arReturn[$group_id] = false;
                     } else {
                         $arGroupToGet[] = $group_id;
                     }
                 }
             }
             if (is_array($arGroupToGet) && count($arGroupToGet) <= 0 || !is_array($arGroupToGet) && intval($arGroupToGet) <= 0) {
                 $arReturn = array();
                 foreach ($id as $group_id) {
                     $arReturn[$group_id] = false;
                 }
                 return $arReturn;
             }
             $resGroupTmp = CSocNetGroup::GetList(array("ID" => "ASC"), array("ID" => $arGroupToGet));
             while ($arGroupTmp = $resGroupTmp->Fetch()) {
                 if ($arGroupTmp["CLOSED"] == "Y" && !in_array($operation, $arSocNetFeaturesSettings[$feature]["minoperation"])) {
                     if (!$bWorkWithClosedGroups) {
                         $arReturn[$arGroupTmp["ID"]] = false;
                         continue;
                     } else {
                         $featureOperationPerms[$arGroupTmp["ID"]] = SONET_ROLES_OWNER;
                     }
                 }
                 if ($bCurrentUserIsAdmin) {
                     $arReturn[$arGroupTmp["ID"]] = true;
                     continue;
                 }
                 if ($featureOperationPerms[$arGroupTmp["ID"]] == SONET_ROLES_ALL) {
                     if ($arGroupTmp["VISIBLE"] == "N") {
                         $featureOperationPerms[$arGroupTmp["ID"]] = SONET_ROLES_USER;
                     } else {
                         $arReturn[$arGroupTmp["ID"]] = true;
                         continue;
                     }
                 }
                 if ($featureOperationPerms[$arGroupTmp["ID"]] == SONET_ROLES_AUTHORIZED) {
                     if ($userID > 0) {
                         $arReturn[$arGroupTmp["ID"]] = true;
                         continue;
                     } else {
                         $arReturn[$arGroupTmp["ID"]] = false;
                         continue;
                     }
                 }
                 if ($userRoleInGroup[$arGroupTmp["ID"]] == false) {
                     $arReturn[$arGroupTmp["ID"]] = false;
                     continue;
                 }
                 if ($featureOperationPerms[$arGroupTmp["ID"]] == SONET_ROLES_MODERATOR) {
                     if ($userRoleInGroup[$arGroupTmp["ID"]] == SONET_ROLES_MODERATOR || $userRoleInGroup[$arGroupTmp["ID"]] == SONET_ROLES_OWNER) {
                         $arReturn[$arGroupTmp["ID"]] = true;
                         continue;
                     } else {
                         $arReturn[$arGroupTmp["ID"]] = false;
                         continue;
                     }
                 } elseif ($featureOperationPerms[$arGroupTmp["ID"]] == SONET_ROLES_USER) {
                     if ($userRoleInGroup[$arGroupTmp["ID"]] == SONET_ROLES_MODERATOR || $userRoleInGroup[$arGroupTmp["ID"]] == SONET_ROLES_OWNER || $userRoleInGroup[$arGroupTmp["ID"]] == SONET_ROLES_USER) {
                         $arReturn[$arGroupTmp["ID"]] = true;
                         continue;
                     } else {
                         $arReturn[$arGroupTmp["ID"]] = false;
                         continue;
                     }
                 } elseif ($featureOperationPerms[$arGroupTmp["ID"]] == SONET_ROLES_OWNER) {
                     if ($userRoleInGroup[$arGroupTmp["ID"]] == SONET_ROLES_OWNER) {
                         $arReturn[$arGroupTmp["ID"]] = true;
                         continue;
                     } else {
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:group_features_perms.php

示例7: intval

 $actionTaskId = intval($_GET['action_task_id']);
 $wf = trim($_GET['wf']);
 if ($actionTaskId > 0 && strlen($wf) > 0) {
     $arErrorsTmp = array();
     $arTaskTmp = CIntranetTasks::GetById($actionTaskId);
     if (!$arTaskTmp) {
         $arErrorsTmp[] = GetMessage("INTS_NO_TASK") . ".<br />";
     }
     if (count($arErrorsTmp) <= 0) {
         $arCurrentUserGroups = array();
         if ($arTaskTmp["TaskType"] == "group") {
             $arCurrentUserGroups[] = SONET_ROLES_ALL;
             if ($GLOBALS["USER"]->IsAuthorized()) {
                 $arCurrentUserGroups[] = SONET_ROLES_AUTHORIZED;
             }
             $r = CSocNetUserToGroup::GetUserRole($USER->GetID(), $arTaskTmp["OwnerId"]);
             if (strlen($r) > 0) {
                 $arCurrentUserGroups[] = $r;
             }
         } else {
             $arCurrentUserGroups[] = SONET_RELATIONS_TYPE_ALL;
             if ($GLOBALS["USER"]->IsAuthorized()) {
                 $arCurrentUserGroups[] = SONET_RELATIONS_TYPE_AUTHORIZED;
             }
             if (CSocNetUserRelations::IsFriends($USER->GetID(), $arTaskTmp["ownerId"])) {
                 $arCurrentUserGroups[] = SONET_RELATIONS_TYPE_FRIENDS;
             } elseif (CSocNetUserRelations::IsFriends2($USER->GetID(), $arTaskTmp["ownerId"])) {
                 $arCurrentUserGroups[] = SONET_RELATIONS_TYPE_FRIENDS2;
             }
         }
         if ($USER->GetID() == $arTaskTmp["CREATED_BY"]) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例8: InitUserPerms

 function InitUserPerms($userID, $arGroup, $bCurrentUserIsAdmin)
 {
     global $arSocNetAllowedInitiatePerms;
     global $arSocNetAllowedSpamPerms;
     $arReturn = array();
     $userID = IntVal($userID);
     $groupID = IntVal($arGroup["ID"]);
     $groupOwnerID = IntVal($arGroup["OWNER_ID"]);
     $groupInitiatePerms = Trim($arGroup["INITIATE_PERMS"]);
     $groupVisible = Trim($arGroup["VISIBLE"]);
     $groupOpened = Trim($arGroup["OPENED"]);
     $groupSpamPerms = Trim($arGroup["SPAM_PERMS"]);
     if ($groupID <= 0 || $groupOwnerID <= 0 || !in_array($groupInitiatePerms, $arSocNetAllowedInitiatePerms)) {
         return false;
     }
     $arReturn["Operations"] = array();
     if (!in_array($groupSpamPerms, $arSocNetAllowedSpamPerms)) {
         $groupSpamPerms = "K";
     }
     // UserRole - User role in group. False if user is not group member.
     // UserIsMember - True in user is group member.
     // UserIsOwner - True if user is group owner.
     // UserCanInitiate - True if user can invite friends to group.
     // UserCanViewGroup - True if user can view group.
     // UserCanAutoJoinGroup - True if user can join group automatically.
     // UserCanModifyGroup - True if user can modify group.
     // UserCanModerateGroup - True if user can moderate group.
     if ($userID <= 0) {
         $arReturn["UserRole"] = false;
         $arReturn["UserIsMember"] = false;
         $arReturn["UserIsOwner"] = false;
         $arReturn["UserCanInitiate"] = false;
         $arReturn["UserCanViewGroup"] = $groupVisible == "Y";
         $arReturn["UserCanAutoJoinGroup"] = false;
         $arReturn["UserCanModifyGroup"] = false;
         $arReturn["UserCanModerateGroup"] = false;
         $arReturn["UserCanSpamGroup"] = false;
         $arReturn["InitiatedByType"] = false;
         $arReturn["Operations"]["viewsystemevents"] = false;
     } else {
         $arReturn["UserRole"] = CSocNetUserToGroup::GetUserRole($userID, $groupID);
         $arReturn["UserIsMember"] = $arReturn["UserRole"] && in_array($arReturn["UserRole"], array(SONET_ROLES_OWNER, SONET_ROLES_MODERATOR, SONET_ROLES_USER));
         $arReturn["InitiatedByType"] = false;
         if ($arReturn["UserRole"] == SONET_ROLES_REQUEST) {
             $dbRelation = CSocNetUserToGroup::GetList(array(), array("USER_ID" => $userID, "GROUP_ID" => $groupID), false, false, array("INITIATED_BY_TYPE"));
             if ($arRelation = $dbRelation->Fetch()) {
                 $arReturn["InitiatedByType"] = $arRelation["INITIATED_BY_TYPE"];
             }
         }
         $arReturn["UserIsOwner"] = $userID == $groupOwnerID;
         if ($bCurrentUserIsAdmin) {
             $arReturn["UserCanInitiate"] = true;
             $arReturn["UserCanViewGroup"] = true;
             $arReturn["UserCanAutoJoinGroup"] = true;
             $arReturn["UserCanModifyGroup"] = true;
             $arReturn["UserCanModerateGroup"] = true;
             $arReturn["UserCanSpamGroup"] = true;
             $arReturn["Operations"]["viewsystemevents"] = true;
         } else {
             if ($arReturn["UserIsMember"]) {
                 $arReturn["UserCanInitiate"] = $groupInitiatePerms == SONET_ROLES_OWNER && $arReturn["UserIsOwner"] || $groupInitiatePerms == SONET_ROLES_MODERATOR && in_array($arReturn["UserRole"], array(SONET_ROLES_OWNER, SONET_ROLES_MODERATOR)) || $groupInitiatePerms == SONET_ROLES_USER && $arReturn["UserIsMember"];
                 $arReturn["UserCanViewGroup"] = true;
                 $arReturn["UserCanAutoJoinGroup"] = false;
                 $arReturn["UserCanModifyGroup"] = $arReturn["UserIsOwner"];
                 $arReturn["UserCanModerateGroup"] = in_array($arReturn["UserRole"], array(SONET_ROLES_OWNER, SONET_ROLES_MODERATOR));
                 $arReturn["UserCanSpamGroup"] = $groupSpamPerms == SONET_ROLES_OWNER && $arReturn["UserIsOwner"] || $groupSpamPerms == SONET_ROLES_MODERATOR && in_array($arReturn["UserRole"], array(SONET_ROLES_OWNER, SONET_ROLES_MODERATOR)) || $groupSpamPerms == SONET_ROLES_USER && $arReturn["UserIsMember"] || $groupSpamPerms == SONET_ROLES_ALL;
                 $arReturn["Operations"]["viewsystemevents"] = true;
             } else {
                 $arReturn["UserCanInitiate"] = false;
                 $arReturn["UserCanViewGroup"] = $groupVisible == "Y";
                 $arReturn["UserCanAutoJoinGroup"] = $arReturn["UserCanViewGroup"] && $groupOpened == "Y";
                 $arReturn["UserCanModifyGroup"] = false;
                 $arReturn["UserCanModerateGroup"] = false;
                 $arReturn["UserCanSpamGroup"] = $groupSpamPerms == SONET_ROLES_ALL;
                 $arReturn["Operations"]["viewsystemevents"] = false;
             }
         }
     }
     if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) {
         $arReturn["UserCanSpamGroup"] = true;
     }
     if (!CBXFeatures::IsFeatureEnabled("WebMessenger")) {
         $arReturn["UserCanSpamGroup"] = false;
     }
     return $arReturn;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:86,代码来源:user_group.php

示例9: GetIBlockPermission

 public static function GetIBlockPermission($iblock_id, $user_id)
 {
     global $USER;
     //IBlock permissions by default
     $Permission = CIBlock::GetPermission($iblock_id, $user_id);
     if ($Permission < "W") {
         $arIBlock = CIBlock::GetArrayByID($iblock_id);
         if ($arIBlock) {
             //Check if iblock is list
             $arListsPerm = CLists::GetPermission($arIBlock["IBLOCK_TYPE_ID"]);
             if (count($arListsPerm)) {
                 //User groups
                 if ($user_id == $USER->GetID()) {
                     $arUserGroups = $USER->GetUserGroupArray();
                 } else {
                     $arUserGroups = $USER->GetUserGroup($user_id);
                 }
                 //One of lists admins
                 if (count(array_intersect($arListsPerm, $arUserGroups))) {
                     $Permission = "X";
                 }
             }
         }
     }
     if ($Permission < "W" && $arIBlock["SOCNET_GROUP_ID"] && CModule::IncludeModule('socialnetwork')) {
         $arSocnetPerm = CLists::GetSocnetPermission($iblock_id);
         $socnet_role = CSocNetUserToGroup::GetUserRole($USER->GetID(), $arIBlock["SOCNET_GROUP_ID"]);
         $Permission = $arSocnetPerm[$socnet_role];
     }
     return $Permission;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:31,代码来源:lists.php

示例10: GetTasksList


//.........这里部分代码省略.........
                    $arPropertyValue = array($arPropertyValue);
                    $arPropertyKey = array($arPropertyKey);
                }
                for ($i = 0, $cnt = count($arPropertyValue); $i < $cnt; $i++) {
                    $arResult["PROPERTY_" . $propertyKey][$arPropertyKey[$i]] = $arPropertyValue[$i];
                }
                $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = $arResult["PROPERTY_" . $propertyKey];
            } elseif ($propertyValue["PROPERTY_TYPE"] == "S" && $propertyValue["ROW_COUNT"] > 1) {
                if (is_array($propertyValue["VALUE"])) {
                    $arResult["PROPERTY_" . $propertyKey] = array();
                    $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = array();
                    if ($isInSecurity) {
                        foreach ($propertyValue["~VALUE"] as $k => $v) {
                            $filter = new CSecurityFilter();
                            $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$k] = $filter->TestXSS($v);
                            $arResult["PROPERTY_" . $propertyKey][$k] = $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$k];
                        }
                    } else {
                        foreach ($propertyValue["VALUE"] as $k => $v) {
                            $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$k] = nl2br($v);
                            $arResult["PROPERTY_" . $propertyKey][$k] = $v;
                        }
                    }
                } else {
                    if ($isInSecurity) {
                        $filter = new CSecurityFilter();
                        $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = $filter->TestXSS($propertyValue["~VALUE"]);
                        $arResult["PROPERTY_" . $propertyKey] = $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"];
                    } else {
                        $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = nl2br($propertyValue["VALUE"]);
                        $arResult["PROPERTY_" . $propertyKey] = $propertyValue["VALUE"];
                    }
                }
            }
        }
        $arResult["ROOT_SECTION_ID"] = 0;
        $arResult["IBLOCK_SECTION_ID_PRINTABLE"] = array();
        $v = CIntranetTasks::PrepareSectionForPrint($arResult["IBLOCK_SECTION_ID"], $iblockId);
        if (is_array($v)) {
            foreach ($v as $k1 => $v1) {
                if ($arResult["ROOT_SECTION_ID"] == 0) {
                    $arResult["ROOT_SECTION_ID"] = $k1;
                    $taskType = $v1["XML_ID"] == "users_tasks" ? "user" : "group";
                    $ownerId = $taskType == "user" ? $arResult["PROPERTY_TaskAssignedTo"] : $v1["XML_ID"];
                } else {
                    $arResult["IBLOCK_SECTION_ID_PRINTABLE"][$k1] = $v1["NAME"];
                }
            }
        }
        if (!array_key_exists($taskType . "_" . $ownerId, $arCache)) {
            $arCurrentUserGroups = array();
            if ($taskType == "group") {
                $arCurrentUserGroups[] = SONET_ROLES_ALL;
                if ($GLOBALS["USER"]->IsAuthorized()) {
                    $arCurrentUserGroups[] = SONET_ROLES_AUTHORIZED;
                }
                $r = CSocNetUserToGroup::GetUserRole($USER->GetID(), $ownerId);
                if (strlen($r) > 0) {
                    $arCurrentUserGroups[] = $r;
                }
            } else {
                $arCurrentUserGroups[] = SONET_RELATIONS_TYPE_ALL;
                if ($GLOBALS["USER"]->IsAuthorized()) {
                    $arCurrentUserGroups[] = SONET_RELATIONS_TYPE_AUTHORIZED;
                }
                if (CSocNetUserRelations::IsFriends($USER->GetID(), $ownerId)) {
                    $arCurrentUserGroups[] = SONET_RELATIONS_TYPE_FRIENDS;
                }
            }
            $arCache[$taskType . "_" . $ownerId] = $arCurrentUserGroups;
        }
        $arCurrentUserGroups = $arCache[$taskType . "_" . $ownerId];
        if ($USER->GetID() == $arResult["CREATED_BY"]) {
            $arCurrentUserGroups[] = "author";
        }
        if ($USER->GetID() == $arResult["PROPERTY_TaskAssignedTo"]) {
            $arCurrentUserGroups[] = "responsible";
        }
        if (is_array($arResult["PROPERTY_TaskTrackers"]) && in_array($USER->GetID(), $arResult["PROPERTY_TaskTrackers"])) {
            $arCurrentUserGroups[] = "trackers";
        }
        $arResult["DocumentState"] = array();
        $arDocumentStates = CBPDocument::GetDocumentStates(array("intranet", "CIntranetTasksDocument", "x" . $iblockId), array("intranet", "CIntranetTasksDocument", $arResult["ID"]));
        $kk = array_keys($arDocumentStates);
        foreach ($kk as $k) {
            $arResult["DocumentState"] = $arDocumentStates[$k];
            $arResult["DocumentState"]["AllowableEvents"] = CBPDocument::GetAllowableEvents($GLOBALS["USER"]->GetID(), $arCurrentUserGroups, $arDocumentStates[$k]);
        }
        $arResult["TaskType"] = $taskType;
        $arResult["OwnerId"] = $ownerId;
        $arResult["CurrentUserCanViewTask"] = CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_READ_DOCUMENT, $GLOBALS["USER"]->GetID(), $arResult["ID"], array("TaskType" => $taskType, "OwnerId" => $ownerId, "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
        $arResult["CurrentUserCanCommentTask"] = CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_COMMENT_DOCUMENT, $GLOBALS["USER"]->GetID(), $arResult["ID"], array("TaskType" => $taskType, "OwnerId" => $ownerId, "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
        $arResult["CurrentUserCanDeleteTask"] = CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_DELETE_DOCUMENT, $GLOBALS["USER"]->GetID(), $arResult["ID"], array("TaskType" => $taskType, "OwnerId" => $ownerId, "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
        $arResult["CurrentUserCanWriteTask"] = CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_WRITE_DOCUMENT, $GLOBALS["USER"]->GetID(), $arResult["ID"], array("TaskType" => $taskType, "OwnerId" => $ownerId, "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
        $arResultList[] = $arResult;
    }
    $dbTasksList = new CDBResult();
    $dbTasksList->InitFromArray($arResultList);
    return $dbTasksList;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:tasks_convert_admin.php

示例11: ChangeStatus

 function ChangeStatus($taskId, $newStatus, $userId = 0)
 {
     CModule::IncludeModule("socialnetwork");
     $taskId = intval($taskId);
     $userId = intval($userId);
     if ($userId == 0) {
         $userId = $GLOBALS["USER"]->GetID();
     }
     $arTask = CIntranetTasks::GetById($taskId);
     if (!$arTask) {
         return;
     }
     $arDocumentStates = CBPDocument::GetDocumentStates(array("intranet", "CIntranetTasksDocument", "x" . $arTask["IBLOCK_ID"]), array("intranet", "CIntranetTasksDocument", $taskId));
     $arCurrentUserGroups = array();
     if ($arTask["TaskType"] == "group") {
         $arCurrentUserGroups[] = SONET_ROLES_ALL;
         if ($GLOBALS["USER"]->IsAuthorized()) {
             $arCurrentUserGroups[] = SONET_ROLES_AUTHORIZED;
         }
         $r = CSocNetUserToGroup::GetUserRole($userId, $arTask["OwnerId"]);
         if (strlen($r) > 0) {
             $arCurrentUserGroups[] = $r;
         }
     }
     if ($userId == $arTask["CREATED_BY"]) {
         $arCurrentUserGroups[] = "author";
     }
     if ($userId == $arTask["PROPERTY_TaskAssignedTo"]) {
         $arCurrentUserGroups[] = "responsible";
     }
     if (is_array($arTask["PROPERTY_TaskTrackers"]) && in_array($userId, $arTask["PROPERTY_TaskTrackers"])) {
         $arCurrentUserGroups[] = "trackers";
     }
     $arStateCommand = array("NotAccepted" => array("NotStarted" => array("HEEA_NotAccepted_ApproveEvent"), "InProgress" => array("HEEA_NotAccepted_InProgressEvent"), "Completed" => array("HEEA_NotAccepted_CompleteEvent"), "Closed" => array("HEEA_NotAccepted_CloseEvent"), "Waiting" => array("HEEA_NotAccepted_ApproveEvent", "HEEA_NotStarted_WaitingEvent"), "Deferred" => array("HEEA_NotAccepted_ApproveEvent", "HEEA_NotStarted_DeferredEvent")), "NotStarted" => array("InProgress" => array("HEEA_NotStarted_InProgressEvent"), "Completed" => array("HEEA_NotStarted_CompleteEvent"), "Closed" => array("HEEA_NotStarted_CloseEvent"), "Waiting" => array("HEEA_NotStarted_WaitingEvent"), "Deferred" => array("HEEA_NotStarted_DeferredEvent")), "InProgress" => array("Completed" => array("HEEA_InProgress_CompleteEvent"), "Closed" => array("HEEA_InProgress_CloseEvent"), "Waiting" => array("HEEA_InProgress_WaitingEvent"), "Deferred" => array("HEEA_InProgress_DeferredEvent")), "Completed" => array("InProgress" => array("HEEA_Completed_InProgressEvent"), "Closed" => array("HEEA_Completed_CloseEvent")), "Waiting" => array("NotStarted" => array("HEEA_Waiting_NotStartedEvent"), "InProgress" => array("HEEA_Waiting_InProgressEvent"), "Completed" => array("HEEA_Waiting_CompleteEvent"), "Closed" => array("HEEA_Waiting_CloseEvent"), "Deferred" => array("HEEA_Waiting_DeferredEvent")), "Deferred" => array("NotStarted" => array("HEEA_Deferred_NotStartedEvent"), "InProgress" => array("HEEA_Deferred_InProgressEvent"), "Completed" => array("HEEA_Deferred_CompleteEvent"), "Closed" => array("HEEA_Deferred_CloseEvent"), "Waiting" => array("HEEA_Deferred_WaitingEvent")));
     foreach ($arDocumentStates as $documentState) {
         $oldState = $documentState["STATE_NAME"];
         if (!array_key_exists($oldState, $arStateCommand) || count($arStateCommand[$oldState]) <= 0) {
             continue;
         }
         if (!array_key_exists($newStatus, $arStateCommand[$oldState]) || count($arStateCommand[$oldState][$newStatus]) <= 0) {
             continue;
         }
         foreach ($arStateCommand[$oldState][$newStatus] as $sc) {
             CBPDocument::SendExternalEvent($documentState["ID"], $sc, array("Groups" => $arCurrentUserGroups, "User" => $userId), $arErrorTmp);
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:47,代码来源:tasks.php

示例12: _socnet_type_check

 /**
  * @param $USER CUser
  * @param $iblock_type_id string
  * @param $socnet_group_id int
  * @return int|string
  */
 protected static function _socnet_type_check($USER, $iblock_type_id, $socnet_group_id)
 {
     if ($iblock_type_id === COption::GetOptionString("lists", "socnet_iblock_type_id")) {
         $socnet_role = CSocNetUserToGroup::GetUserRole($USER->GetID(), $socnet_group_id);
         if ($socnet_role == "A" && CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_GROUP, $socnet_group_id, "group_lists", "write", CSocNetUser::IsCurrentUserModuleAdmin())) {
             return CListPermissions::IS_ADMIN;
         } else {
             return CListPermissions::CAN_READ;
         }
     } else {
         return CListPermissions::WRONG_IBLOCK_TYPE;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:19,代码来源:listperm.php

示例13: CanUserOperateDocumentType

 /**
  * Метод проверяет права на выполнение операций над документами заданного типа. Проверяются операции 4 - право изменять шаблоны рабочий потоков для данного типа документа.
  *
  * @param int $operation - операция.
  * @param int $userId - код пользователя, для которого проверяется право на выполнение операции.
  * @param string $documentId - код типа документа, к которому применяется операция.
  * @param array $arParameters - ассициативный массив вспомогательных параметров. Используется для того, чтобы не рассчитывать заново те вычисляемые значения, которые уже известны на момент вызова метода. Стандартными являются ключи массива DocumentStates - массив состояний рабочих потоков данного документа, WorkflowId - код рабочего потока (если требуется проверить операцию на одном рабочем потоке). Массив может быть дополнен другими произвольными ключами.
  * @return bool
  */
 public function CanUserOperateDocumentType($operation, $userId, $documentType, $arParameters = array())
 {
     $documentType = trim($documentType);
     if (strlen($documentType) <= 0) {
         return false;
     }
     $iblockId = COption::GetOptionInt("intranet", "iblock_tasks", 0);
     if ($iblockId <= 0) {
         return false;
     }
     $userId = intval($userId);
     global $USER;
     if ($USER->IsAuthorized() && $USER->GetID() == $userId && CSocNetUser::IsCurrentUserModuleAdmin()) {
         return true;
     }
     $arDt = explode("_", $documentType);
     if (count($arDt) != 2) {
         return false;
     }
     $taskType = $arDt[0];
     $ownerId = intval($arDt[1]);
     if (!in_array($taskType, array("user", "group")) || $ownerId <= 0) {
         return false;
     }
     if (!array_key_exists("AllUserGroups", $arParameters)) {
         if (!array_key_exists("UserGroups", $arParameters)) {
             $arParameters["UserGroups"] = array();
             if ($taskType == "user") {
                 //					$arParameters["UserGroups"][] = SONET_RELATIONS_TYPE_ALL;
                 //					if (CSocNetUserRelations::IsFriends($userId, $ownerId))
                 //						$arParameters["UserGroups"][] = SONET_RELATIONS_TYPE_FRIENDS;
                 //					elseif (CSocNetUserRelations::IsFriends2($userId, $ownerId))
                 //						$arParameters["UserGroups"][] = SONET_RELATIONS_TYPE_FRIENDS2;
             } else {
                 $arParameters["UserGroups"][] = SONET_ROLES_ALL;
                 if ($GLOBALS["USER"]->IsAuthorized()) {
                     $arParameters["UserGroups"][] = SONET_ROLES_AUTHORIZED;
                 }
                 $r = CSocNetUserToGroup::GetUserRole($userId, $ownerId);
                 if (strlen($r) > 0) {
                     $arParameters["UserGroups"][] = $r;
                 }
             }
         }
         $arParameters["AllUserGroups"] = $arParameters["UserGroups"];
         $arParameters["AllUserGroups"][] = "author";
     }
     if (!array_key_exists("DocumentStates", $arParameters)) {
         $arParameters["DocumentStates"] = CBPDocument::GetDocumentStates(array("intranet", "CIntranetTasksDocument", "x" . $iblockId), null);
     }
     // Если нужно проверить только для одного рабочего потока
     if (array_key_exists("WorkflowId", $arParameters)) {
         if (array_key_exists($arParameters["WorkflowId"], $arParameters["DocumentStates"])) {
             $arParameters["DocumentStates"] = array($arParameters["WorkflowId"] => $arParameters["DocumentStates"][$arParameters["WorkflowId"]]);
         } else {
             return false;
         }
     }
     $arAllowableOperations = CBPDocument::GetAllowableOperations($userId, $arParameters["AllUserGroups"], $arParameters["DocumentStates"]);
     // $arAllowableOperations == null - поток не является автоматом
     // $arAllowableOperations == array() - в автомате нет допустимых операций
     // $arAllowableOperations == array("read", ...) - допустимые операции
     if (!is_array($arAllowableOperations)) {
         return false;
     }
     $r = false;
     switch ($operation) {
         case INTASK_DOCUMENT_OPERATION_VIEW_WORKFLOW:
             $r = false;
             break;
         case INTASK_DOCUMENT_OPERATION_START_WORKFLOW:
             $r = false;
             break;
         case INTASK_DOCUMENT_OPERATION_CREATE_WORKFLOW:
             $r = false;
             break;
         case INTASK_DOCUMENT_OPERATION_WRITE_DOCUMENT:
             $r = in_array("write", $arAllowableOperations);
             break;
         case INTASK_DOCUMENT_OPERATION_READ_DOCUMENT:
             $r = false;
             break;
         case INTASK_DOCUMENT_OPERATION_COMMENT_DOCUMENT:
             $r = false;
             break;
         case INTASK_DOCUMENT_OPERATION_DELETE_DOCUMENT:
             $r = false;
             break;
         default:
             $r = false;
     }
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:tasks_document.php

示例14: HasUserReadAccessToGroup

 /**
  * @param integer $userId
  * @param integer $groupId
  * @return bool true if user can access group, false otherwise
  */
 public static function HasUserReadAccessToGroup($userId, $groupId)
 {
     // Roles allowed for extranet user to grant access to read task in group
     static $arAllowedRoles = array(SONET_ROLES_MODERATOR, SONET_ROLES_USER, SONET_ROLES_OWNER);
     if (!CModule::IncludeModule('socialnetwork')) {
         return false;
     }
     if (!($userId > 0 && $groupId > 0)) {
         return false;
     }
     if (self::IsIntranetUser($userId)) {
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         return CSocNetGroup::CanUserViewGroup($userId, $groupId);
     }
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $userRole = CSocNetUserToGroup::GetUserRole($userId, $groupId);
     if (in_array($userRole, $arAllowedRoles)) {
         return true;
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:26,代码来源:tasktools.php

示例15: intval

if (!CModule::IncludeModule("socialnetwork")) {
    echo CUtil::PhpToJsObject(array('ERROR' => 'SONET_MODULE_NOT_INSTALLED'));
    die;
}
if (!$GLOBALS["USER"]->IsAuthorized()) {
    echo CUtil::PhpToJsObject(array("ERROR" => "CURRENT_USER_NOT_AUTH"));
    die;
}
$groupID = intval($_POST["groupID"]);
if ($groupID <= 0) {
    echo CUtil::PhpToJsObject(array("ERROR" => "EMPTY_GROUP_ID"));
    die;
}
if (check_bitrix_sessid()) {
    if (in_array($_POST["action"], array("set", "unset"))) {
        $userRole = CSocNetUserToGroup::GetUserRole($GLOBALS["USER"]->GetID(), $groupID);
        if (!in_array($userRole, array(SONET_ROLES_OWNER, SONET_ROLES_MODERATOR, SONET_ROLES_USER))) {
            echo CUtil::PhpToJsObject(array("ERROR" => "INCORRECT_USER_ROLE"));
            die;
        }
        if (CSocNetSubscription::Set($GLOBALS["USER"]->GetID(), "SG" . $groupID, $_POST["action"] == "set" ? "Y" : "N")) {
            $rsSubscription = CSocNetSubscription::GetList(array(), array("USER_ID" => $GLOBALS["USER"]->GetID(), "CODE" => "SG" . $groupID));
            if ($arSubscription = $rsSubscription->Fetch()) {
                echo CUtil::PhpToJsObject(array("SUCCESS" => "Y", "RESULT" => "Y"));
            } else {
                echo CUtil::PhpToJsObject(array("SUCCESS" => "Y", "RESULT" => "N"));
            }
        }
    } else {
        echo CUtil::PhpToJsObject(array("ERROR" => "UNKNOWN_ACTION"));
    }
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:ajax.php


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