本文整理汇总了PHP中CSocNetFeaturesPerms类的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetFeaturesPerms类的具体用法?PHP CSocNetFeaturesPerms怎么用?PHP CSocNetFeaturesPerms使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSocNetFeaturesPerms类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __InTaskDeleteView
function __InTaskDeleteView($delViewId, $iblockId, $taskType, $ownerId)
{
$delViewId = IntVal($delViewId);
$iblockId = IntVal($iblockId);
$ownerId = IntVal($ownerId);
if ($delViewId <= 0 || $iblockId <= 0 || $ownerId <= 0) {
return "";
}
$errorMessage = "";
$userSettingsCategory = "IntranetTasks";
$userSettingsNamePart = "Settings_";
$arUserSettings = CUserOptions::GetOption($userSettingsCategory, $userSettingsNamePart . $delViewId, false, $GLOBALS["USER"]->GetID());
if (!$arUserSettings) {
$errorMessage .= GetMessage("INTL_VIEW_NOT_FOUND") . ".";
}
if (StrLen($errorMessage) <= 0) {
if ($arUserSettings["IBLOCK_ID"] != $iblockId || $arUserSettings["TASK_TYPE"] != $taskType || $arUserSettings["OWNER_ID"] != $ownerId) {
$errorMessage .= GetMessage("INTL_WRONG_VIEW") . ".";
}
}
if (StrLen($errorMessage) <= 0) {
if ($arUserSettings["COMMON"] != "N") {
$canModifyCommon = $taskType == 'user' && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $ownerId, "tasks", 'modify_common_views') || $taskType == 'group' && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $ownerId, "tasks", 'modify_common_views');
if (!$canModifyCommon) {
$errorMessage .= GetMessage("INTL_NO_VIEW_PERMS") . ".";
}
}
}
if (StrLen($errorMessage) <= 0) {
CUserOptions::DeleteOption($userSettingsCategory, $userSettingsNamePart . $delViewId, $arUserSettings["COMMON"] == "Y" ? true : false, $GLOBALS["USER"]->GetID());
}
return $errorMessage;
}
示例2: filterByFeaturePerms
function filterByFeaturePerms(&$arGroups, $arFeaturePerms)
{
$arGroupsIDs = array();
foreach ($arGroups as $value) {
$arGroupsIDs[] = $value["ID"];
}
if (sizeof($arGroupsIDs) > 0) {
$feature = $arFeaturePerms[0];
$operations = $arFeaturePerms[1];
if (!is_array($operations)) {
$operations = explode(",", $operations);
}
$arGroupsPerms = array();
foreach ($operations as $operation) {
$tmpOps = CSocNetFeaturesPerms::CurrentUserCanPerformOperation(SONET_ENTITY_GROUP, $arGroupsIDs, $feature, $operation);
if (is_array($tmpOps)) {
foreach ($tmpOps as $key => $val) {
if (!$arGroupsPerms[$key]) {
$arGroupsPerms[$key] = $val;
}
}
}
}
$arGroupsActive = CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arGroupsIDs, $arFeaturePerms[0]);
foreach ($arGroups as $key => $group) {
if (!$arGroupsActive[$group["ID"]] || !$arGroupsPerms[$group["ID"]]) {
unset($arGroups[$key]);
}
}
}
$arGroups = array_values($arGroups);
}
示例3: CanUserDeletePost
public static function CanUserDeletePost($ID, $userID, $blogOwnerID, $groupOwnerID)
{
$ID = IntVal($ID);
$userID = IntVal($userID);
$blogOwnerID = IntVal($blogOwnerID);
$groupOwnerID = IntVal($groupOwnerID);
$blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
if ($blogModulePermissions >= "W") {
return True;
}
$arPost = CBlogPost::GetByID($ID);
if (empty($arPost)) {
return False;
}
if ($groupOwnerID > 0) {
$arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y") {
return False;
}
$perms = BLOG_PERMS_DENY;
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "view_post")) {
$perms = BLOG_PERMS_READ;
}
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "write_post")) {
$perms = BLOG_PERMS_WRITE;
}
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "full_post")) {
$perms = BLOG_PERMS_FULL;
}
if ($perms >= BLOG_PERMS_WRITE && $arPost["AUTHOR_ID"] == $userID) {
return true;
}
if ($perms > BLOG_PERMS_WRITE) {
return true;
}
} else {
$arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
$arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y") {
return False;
}
$perms = BLOG_PERMS_DENY;
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "view_post")) {
$perms = BLOG_PERMS_READ;
}
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "write_post")) {
$perms = BLOG_PERMS_WRITE;
}
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "full_post")) {
$perms = BLOG_PERMS_FULL;
}
if ($perms >= BLOG_PERMS_WRITE && $arPost["AUTHOR_ID"] == $userID) {
return true;
}
if ($perms > BLOG_PERMS_WRITE) {
return true;
}
}
return False;
}
示例4: move
/**
*
* Moves the source task before/after the target task;
* @param array $data
* @return false|array
*/
public function move($data)
{
global $USER;
if (!$USER->isAuthorized()) {
$this->errors->add("AUTH_REQUIRED", Loc::getMessage("TASKS_SORTING_AUTH_REQUIRED"));
return false;
}
$sourceId = isset($data["sourceId"]) ? intval($data["sourceId"]) : 0;
$targetId = isset($data["targetId"]) ? intval($data["targetId"]) : 0;
$before = isset($data["before"]) && ($data["before"] === true || $data["before"] === "true") ? true : false;
$newGroupId = isset($data["newGroupId"]) ? intval($data["newGroupId"]) : null;
$newParentId = isset($data["newParentId"]) ? intval($data["newParentId"]) : null;
$currentGroupId = isset($data["currentGroupId"]) ? intval($data["currentGroupId"]) : 0;
$userId = $USER->getId();
if ($sourceId === $targetId || $sourceId < 1) {
return array();
}
$sourceTask = new \CTaskItem($sourceId, $userId);
if (!$sourceTask->checkCanRead()) {
$this->errors->add("SOURCE_TASK_NOT_FOUND", Loc::getMessage("TASKS_SORTING_WRONG_SOURCE_TASK"));
return false;
}
if ($currentGroupId) {
$group = \CSocNetGroup::getByID($currentGroupId);
$canEdit = \CSocNetFeaturesPerms::currentUserCanPerformOperation(SONET_ENTITY_GROUP, $currentGroupId, "tasks", "edit_tasks");
if (!$group || !$canEdit) {
$this->errors->add("GROUP_PERMS_NOT_FOUND", Loc::getMessage("TASKS_SORTING_WRONG_GROUP_PERMISSIONS"));
return false;
}
}
/*
GROUP_ID and PARENT_ID could be changed after drag&drop manipulations.
Target task is not required. Example: We want to move Task 1 after Project. In this case a target task is undefined.
Task 1
Project (without tasks)
*/
$newTaskData = array();
if ($newGroupId !== null) {
$newTaskData["GROUP_ID"] = $newGroupId;
}
if ($newParentId !== null) {
$newTaskData["PARENT_ID"] = $newParentId;
}
if (count($newTaskData)) {
$sourceTask->update($newTaskData);
}
//But it's required for sorting
if ($targetId < 1) {
return array();
}
$targetTask = new \CTaskItem($targetId, $userId);
if (!$targetTask->checkCanRead()) {
$this->errors->add("TARGET_TASK_NOT_FOUND", Loc::getMessage("TASKS_SORTING_WRONG_TARGET_TASK"));
return false;
}
SortingTable::setSorting($userId, $currentGroupId, $sourceId, $targetId, $before);
return array();
}
示例5: Add
/**
* <p>Создает новое право.</p> <p><b>Примечание</b>: для установки параметров права может так же использоваться метод <a href="http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetFeaturesPerms/SetPerm.php">CSocNetFeaturesPerms::SetPerm</a>.</p>
*
*
*
*
* @param array $arFields Массив значений параметров. Допустимые ключи:<br> FEATURE_ID - код
* дополнительного функционала,<br> OPERATION_ID - код операции,<br> ROLE - роль.
*
*
*
* @return int <p>Код вставленной записи.</p>
*
*
* <h4>See Also</h4>
* <ul> <li><a
* href="http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetFeaturesPerms/SetPerm.php">CSocNetFeaturesPerms::SetPerm</a></li>
* <li><a
* href="http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetFeaturesPerms/Update.php">CSocNetFeaturesPerms::Update</a></li>
* </ul>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetFeaturesPerms/Add.php
* @author Bitrix
*/
public static function Add($arFields)
{
global $DB;
$arFields1 = array();
foreach ($arFields as $key => $value)
{
if (substr($key, 0, 1) == "=")
{
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSocNetFeaturesPerms::CheckFields("ADD", $arFields))
return false;
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetFeaturesPermsAdd");
while ($arEvent = $db_events->Fetch())
if (ExecuteModuleEventEx($arEvent, array($arFields))===false)
return false;
$arInsert = $DB->PrepareInsert("b_sonet_features2perms", $arFields);
foreach ($arFields1 as $key => $value)
{
if (strlen($arInsert[0]) > 0)
$arInsert[0] .= ", ";
$arInsert[0] .= $key;
if (strlen($arInsert[1]) > 0)
$arInsert[1] .= ", ";
$arInsert[1] .= $value;
}
$ID = false;
if (strlen($arInsert[0]) > 0)
{
$strSql =
"INSERT INTO b_sonet_features2perms(".$arInsert[0].") ".
"VALUES(".$arInsert[1].")";
$DB->Query($strSql, False, "File: ".__FILE__."<br>Line: ".__LINE__);
$ID = IntVal($DB->LastID());
$events = GetModuleEvents("socialnetwork", "OnSocNetFeaturesPermsAdd");
while ($arEvent = $events->Fetch())
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
if (
intval($arFields["FEATURE_ID"]) > 0
&& defined("BX_COMP_MANAGED_CACHE")
)
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_feature_".$arFields["FEATURE_ID"]);
}
return $ID;
}
示例6: __ShowGroupField
function __ShowGroupField($name, $propertyField, $value, $taskType = "group")
{
if (!is_array($value)) {
$value = array($value);
}
$flag = 0;
$ha = false;
$res = "";
$bWas = false;
$dbSections = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $propertyField["IBLOCK_ID"]));
while ($arSections = $dbSections->GetNext()) {
if ($taskType == "group") {
if ($flag == 0) {
if ($arSections["EXTERNAL_ID"] != $propertyField["ROOT_ID"]) {
continue;
}
$flag = $arSections["DEPTH_LEVEL"];
continue;
} else {
if ($flag == $arSections["DEPTH_LEVEL"]) {
break;
}
}
} else {
$flag = 1;
if ($arSections["DEPTH_LEVEL"] == 1) {
if ($arSections["XML_ID"] == "users_tasks") {
$ha = true;
} else {
$ha = CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arSections["XML_ID"], "tasks", $arResult["arSocNetFeaturesSettings"]["tasks"]["minoperation"][0]);
}
}
if (!$ha) {
continue;
}
}
$res .= '<option value="' . $arSections["ID"] . '"';
if (in_array($arSections["ID"], $value)) {
$bWas = true;
$res .= ' selected';
}
$res .= '>' . str_repeat(" . ", $arSections["DEPTH_LEVEL"] - $flag) . $arSections["NAME"] . '</option>';
}
echo '<select name="' . $name . '" style="width:98%">';
echo '<option value=""' . (!$bWas ? ' selected' : '') . '>' . GetMessage("INTVT_NOT_SET") . '</option>';
echo $res;
echo '</select>';
}
示例7: OnFillSocNetMenu
public static function OnFillSocNetMenu(&$arResult, $arParams = array())
{
global $USER;
$arResult["AllowSettings"]["group_lists"] = true;
$arResult["CanView"]["group_lists"] = (array_key_exists("ActiveFeatures", $arResult) ? array_key_exists("group_lists", $arResult["ActiveFeatures"]) : true) && CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), $arParams["ENTITY_TYPE"], $arParams["ENTITY_ID"], "group_lists", "view", CSocNetUser::IsCurrentUserModuleAdmin());
$arResult["Title"]["group_lists"] = array_key_exists("ActiveFeatures", $arResult) && array_key_exists("group_lists", $arResult["ActiveFeatures"]) && strlen($arResult["ActiveFeatures"]["group_lists"]) > 0 ? $arResult["ActiveFeatures"]["group_lists"] : GetMessage("LISTS_SOCNET_TAB");
if (!array_key_exists("SEF_MODE", $arResult) || $arResult["SEF_MODE"] != "N") {
if (isset($arResult["Urls"])) {
$arResult["Urls"]["group_lists"] = $arResult["Urls"]["view"] . "lists/";
}
} else {
if (!array_key_exists("PAGE_VAR", $arResult)) {
$arResult["PAGE_VAR"] = "page";
}
if (!array_key_exists("GROUP_VAR", $arResult)) {
$arResult["GROUP_VAR"] = "group_id";
}
$arResult["Urls"]["group_lists"] = "?" . $arResult["PAGE_VAR"] . "=group_lists&" . $arResult["GROUP_VAR"] . "=" . $arResult["Group"]["ID"];
}
}
示例8: GetSearchGroups
function GetSearchGroups($entity_type, $entity_id, $feature, $operation)
{
$arResult = array();
if ($entity_type == "G") {
$prefix = "SG" . $entity_id . "_";
$letter = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_GROUP, $entity_id, $feature, $operation);
switch ($letter) {
case "N":
//All
$arResult[] = 'G2';
break;
case "L":
//Authorized
$arResult[] = 'AU';
break;
case "K":
//Group members includes moderators and admins
$arResult[] = $prefix . 'K';
case "E":
//Moderators includes admins
$arResult[] = $prefix . 'E';
case "A":
//Admins
$arResult[] = $prefix . 'A';
break;
}
} else {
$prefix = "SU" . $entity_id . "_";
$letter = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_USER, $entity_id, $feature, $operation);
switch ($letter) {
case "A":
//All
$arResult[] = 'G2';
break;
case "C":
//Authorized
$arResult[] = 'AU';
break;
case "E":
//Friends of friends (has no rights yet) so it counts as
//Friends of friends (has no rights yet) so it counts as
case "M":
//Friends
$arResult[] = $prefix . 'M';
case "Z":
//Personal
$arResult[] = $prefix . 'Z';
break;
}
}
return $arResult;
}
示例9: MkFilter
//.........这里部分代码省略.........
$MODULE_ID = "iblock";
$ENTITY = "CIBlockDocument";
$PERMISSION = $val;
$arUserGroups = false;
$USER_ID = 0;
}
if ($PERMISSION == "read" || $PERMISSION == "write") {
if (!is_array($arUserGroups) && is_object($USER)) {
$USER_ID = intval($USER->GetID());
$arUserGroups = $USER->GetUserGroupArray();
}
if (!is_array($arUserGroups) || count($arUserGroups) <= 0) {
$arUserGroups = array(2);
}
$arSqlSearch[] = "EXISTS (\n\t\t\t\t\t\t\tSELECT S.DOCUMENT_ID_INT\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tb_bp_workflow_state S\n\t\t\t\t\t\t\tINNER JOIN b_bp_workflow_permissions P ON S.ID = P.WORKFLOW_ID\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tS.DOCUMENT_ID_INT = BE.ID\n\t\t\t\t\t\t\t\tAND S.MODULE_ID = '{$MODULE_ID}'\n\t\t\t\t\t\t\t\tAND S.ENTITY = '{$ENTITY}'\n\t\t\t\t\t\t\t\tAND P.PERMISSION = '{$PERMISSION}'\n\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\tP.OBJECT_ID IN ('" . implode("', '", $arUserGroups) . "')\n\t\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = 'Author' AND BE.CREATED_BY = {$USER_ID})\n\t\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = " . $DB->Concat("'USER_'", "'{$USER_ID}'") . ")\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)";
}
}
break;
case "CHECK_BP_TASKS_PERMISSIONS":
if (IsModuleInstalled('bizproc') && CModule::IncludeModule("socialnetwork") && (!is_object($USER) || !$USER->IsAdmin())) {
$val = explode("_", $val);
$taskType = $val[0];
if (!in_array($taskType, array("user", "group"))) {
$taskType = "user";
}
$ownerId = intval($val[1]);
$val = $val[2];
if (!in_array($val, array("read", "write", "comment"))) {
$val = "write";
}
$userId = is_object($USER) ? intval($USER->GetID()) : 0;
$arUserGroups = array();
if ($taskType == "group") {
$r = CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_GROUP, $ownerId, "tasks", $val == "write" ? "edit_tasks" : "view_all");
if ($r) {
break;
}
$arUserGroups[] = SONET_ROLES_ALL;
$r = CSocNetUserToGroup::GetUserRole($userId, $ownerId);
if (strlen($r) > 0) {
$arUserGroups[] = $r;
}
} else {
// $arUserGroups[] = SONET_RELATIONS_TYPE_ALL;
// if (CSocNetUserRelations::IsFriends($userId, $ownerId))
// $arUserGroups[] = SONET_RELATIONS_TYPE_FRIENDS;
// elseif (CSocNetUserRelations::IsFriends2($userId, $ownerId))
// $arUserGroups[] = SONET_RELATIONS_TYPE_FRIENDS2;
}
$arSqlSearch[] = "EXISTS (\n\t\t\t\t\t\tSELECT S.DOCUMENT_ID_INT\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\tb_bp_workflow_state S\n\t\t\t\t\t\tINNER JOIN b_bp_workflow_permissions P ON S.ID = P.WORKFLOW_ID\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tS.DOCUMENT_ID_INT = BE.ID\n\t\t\t\t\t\t\tAND S.MODULE_ID = 'intranet'\n\t\t\t\t\t\t\tAND S.ENTITY = 'CIntranetTasksDocument'\n\t\t\t\t\t\t\tAND P.PERMISSION = '" . $val . "'\n\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t" . ($taskType == "group" ? "P.OBJECT_ID IN ('" . implode("', '", $arUserGroups) . "') OR" : "") . "\n\t\t\t\t\t\t\t\t(P.OBJECT_ID = 'author' AND BE.CREATED_BY = " . $userId . ")\n\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = 'responsible' AND " . $userId . " IN (\n\t\t\t\t\t\t\t\t\tSELECT SFPV0.VALUE_NUM\n\t\t\t\t\t\t\t\t\tFROM b_iblock_element_property SFPV0\n\t\t\t\t\t\t\t\t\t\tINNER JOIN b_iblock_property SFP0 ON (SFPV0.IBLOCK_PROPERTY_ID = SFP0.ID)\n\t\t\t\t\t\t\t\t\tWHERE " . CIBlock::_Upper("SFP0.CODE") . "='TASKASSIGNEDTO'\n\t\t\t\t\t\t\t\t\t\tAND SFP0.IBLOCK_ID = BE.IBLOCK_ID\n\t\t\t\t\t\t\t\t\t\tAND SFPV0.IBLOCK_ELEMENT_ID = BE.ID\n\t\t\t\t\t\t\t\t))\n\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = 'trackers' AND " . $userId . " IN (\n\t\t\t\t\t\t\t\t\tSELECT SFPV0.VALUE_NUM\n\t\t\t\t\t\t\t\t\tFROM b_iblock_element_property SFPV0\n\t\t\t\t\t\t\t\t\t\tINNER JOIN b_iblock_property SFP0 ON (SFPV0.IBLOCK_PROPERTY_ID = SFP0.ID)\n\t\t\t\t\t\t\t\t\tWHERE " . CIBlock::_Upper("SFP0.CODE") . "='TASKTRACKERS'\n\t\t\t\t\t\t\t\t\t\tAND SFP0.IBLOCK_ID = BE.IBLOCK_ID\n\t\t\t\t\t\t\t\t\t\tAND SFPV0.IBLOCK_ELEMENT_ID = BE.ID\n\t\t\t\t\t\t\t\t))\n\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = '" . ("USER_" . $userId) . "')\n\t\t\t\t\t\t\t)\n\t\t\t\t\t)";
}
break;
case "CHECK_BP_VIRTUAL_PERMISSIONS":
if (IsModuleInstalled('bizproc') && (!is_object($USER) || !$USER->IsAdmin())) {
if (!in_array($val, array("read", "create", "admin"))) {
$val = "admin";
}
$userId = is_object($USER) ? intval($USER->GetID()) : 0;
if (is_object($USER)) {
$arUserGroups = $USER->GetUserGroupArray();
}
if (!is_array($arUserGroups) || count($arUserGroups) <= 0) {
$arUserGroups = array(2);
}
$arSqlSearch[] = "EXISTS (\n\t\t\t\t\t\tSELECT S.DOCUMENT_ID_INT\n\t\t\t\t\t\tFROM b_bp_workflow_state S\n\t\t\t\t\t\t\tINNER JOIN b_bp_workflow_permissions P ON S.ID = P.WORKFLOW_ID\n\t\t\t\t\t\tWHERE S.DOCUMENT_ID_INT = BE.ID\n\t\t\t\t\t\t\tAND S.MODULE_ID = 'bizproc'\n\t\t\t\t\t\t\tAND S.ENTITY = 'CBPVirtualDocument'\n\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t(P.PERMISSION = '" . $val . "'\n\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\tP.OBJECT_ID IN ('" . implode("', '", $arUserGroups) . "')\n\t\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = 'Author' AND BE.CREATED_BY = " . $userId . ")\n\t\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = " . $DB->Concat("'USER_'", "'" . $userId . "'") . ")\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t)";
}
示例10: SetForSonet
function SetForSonet($logID, $entity_type, $entity_id, $feature, $operation, $bNew = false)
{
$bFlag = true;
if (!$bNew) {
$rsRights = CSocNetLogRights::GetList(array(), array("LOG_ID" => $logID));
if ($arRights = $rsRights->Fetch()) {
$bFlag = false;
}
}
if ($bFlag) {
$bExtranet = false;
$perm = CSocNetFeaturesPerms::GetOperationPerm($entity_type, $entity_id, $feature, $operation);
if ($perm) {
if (CModule::IncludeModule("extranet") && ($extranet_site_id = CExtranet::GetExtranetSiteID())) {
$arLogSites = array();
$rsLogSite = CSocNetLog::GetSite($logID);
while ($arLogSite = $rsLogSite->Fetch()) {
$arLogSites[] = $arLogSite["LID"];
}
if (in_array($extranet_site_id, $arLogSites)) {
$bExtranet = true;
}
}
if ($bExtranet) {
if ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_OWNER) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER));
} elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_MODERATOR) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR));
} elseif ($entity_type == SONET_ENTITY_GROUP && in_array($perm, array(SONET_ROLES_USER, SONET_ROLES_AUTHORIZED, SONET_ROLES_ALL))) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_USER));
} elseif ($entity_type == SONET_ENTITY_USER && $perm == SONET_RELATIONS_TYPE_NONE) {
CSocNetLogRights::Add($logID, array("SA", "U" . $entity_id));
} elseif ($entity_type == SONET_ENTITY_USER && in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS, SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_AUTHORIZED, SONET_RELATIONS_TYPE_ALL))) {
$arCode = array("SA");
$arLog = CSocNetLog::GetByID($logID);
if ($arLog) {
$dbUsersInGroup = CSocNetUserToGroup::GetList(array(), array("USER_ID" => $arLog["USER_ID"], "<=ROLE" => SONET_ROLES_USER, "GROUP_SITE_ID" => $extranet_site_id, "GROUP_ACTIVE" => "Y"), false, false, array("ID", "GROUP_ID"));
while ($arUsersInGroup = $dbUsersInGroup->Fetch()) {
if (!in_array("S" . SONET_ENTITY_GROUP . $arUsersInGroup["GROUP_ID"] . "_" . SONET_ROLES_USER, $arCode)) {
$arCode = array_merge($arCode, array("S" . SONET_ENTITY_GROUP . $arUsersInGroup["GROUP_ID"] . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $arUsersInGroup["GROUP_ID"] . "_" . SONET_ROLES_MODERATOR, "S" . SONET_ENTITY_GROUP . $arUsersInGroup["GROUP_ID"] . "_" . SONET_ROLES_USER));
}
}
CSocNetLogRights::Add($logID, $arCode);
}
}
} else {
if ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_OWNER) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER));
} elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_MODERATOR) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR));
} elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_USER) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_USER));
} elseif ($entity_type == SONET_ENTITY_USER && in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS, SONET_RELATIONS_TYPE_FRIENDS2))) {
$arCodes = array("SA", "U" . $entity_id, "S" . $entity_type . $entity_id . "_" . SONET_RELATIONS_TYPE_FRIENDS);
if ($perm == SONET_RELATIONS_TYPE_FRIENDS2) {
$arCodes[] = "S" . $entity_type . $entity_id . "_" . SONET_RELATIONS_TYPE_FRIENDS2;
}
CSocNetLogRights::Add($logID, $arCodes);
} elseif ($entity_type == SONET_ENTITY_USER && $perm == SONET_RELATIONS_TYPE_NONE) {
CSocNetLogRights::Add($logID, array("SA", "U" . $entity_id));
} elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_AUTHORIZED) {
CSocNetLogRights::Add($logID, array("SA", "S" . $entity_type . $entity_id, "AU"));
} elseif ($entity_type == SONET_ENTITY_USER && $perm == SONET_RELATIONS_TYPE_AUTHORIZED) {
CSocNetLogRights::Add($logID, array("SA", "AU"));
} elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_ALL) {
CSocNetLogRights::Add($logID, array("SA", "S" . $entity_type . $entity_id, "G2"));
} elseif ($entity_type == SONET_ENTITY_USER && $perm == SONET_RELATIONS_TYPE_ALL) {
CSocNetLogRights::Add($logID, array("SA", "G2"));
}
}
}
}
}
示例11: array
$arResult["BLOG"] = array("SHOW" => false, "TITLE" => GetMessage("SONET_C39_BLOG_TITLE"));
if (array_key_exists("blog", $arResult["ActiveFeatures"]) && (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "blog", "view_post", CSocNetUser::IsCurrentUserModuleAdmin()) || $APPLICATION->GetGroupRight("blog") >= "W") && CModule::IncludeModule("blog")) {
$arResult["BLOG"]["SHOW"] = true;
if (StrLen($arResult["ActiveFeatures"]["blog"]) > 0) {
$arResult["BLOG"]["TITLE"] = $arResult["ActiveFeatures"]["blog"];
}
}
$arResult["forum"] = array("SHOW" => false, "TITLE" => GetMessage("SONET_C39_FORUM_TITLE"));
if (array_key_exists("forum", $arResult["ActiveFeatures"]) && (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "forum", "view", CSocNetUser::IsCurrentUserModuleAdmin()) || $APPLICATION->GetGroupRight("forum") >= "W") && CModule::IncludeModule("forum")) {
$arResult["forum"]["SHOW"] = true;
if (StrLen($arResult["ActiveFeatures"]["forum"]) > 0) {
$arResult["forum"]["TITLE"] = $arResult["ActiveFeatures"]["forum"];
}
}
$arResult["tasks"] = array("SHOW" => false, "TITLE" => GetMessage("SONET_C39_TASKS_TITLE"));
if (array_key_exists("tasks", $arResult["ActiveFeatures"]) && (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "tasks", "view", CSocNetUser::IsCurrentUserModuleAdmin()) || $APPLICATION->GetGroupRight("intranet") >= "W") && CModule::IncludeModule("intranet")) {
$arResult["tasks"]["SHOW"] = true;
if (StrLen($arResult["ActiveFeatures"]["tasks"]) > 0) {
$arResult["tasks"]["TITLE"] = $arResult["ActiveFeatures"]["tasks"];
}
}
}
}
if (array_key_exists("RatingMultiple", $arResult) && count($arResult["RatingMultiple"]) > 0) {
foreach ($arParams["RATING_ID_ARR"] as $rating_id) {
if (array_key_exists($rating_id, $arResult["RatingMultiple"])) {
$arResult["RatingMultiple"][$rating_id]["VALUE"] = $arResult["User"]["RATING_" . $rating_id . "_CURRENT_VALUE"];
}
}
}
}
示例12: GetMessage
$userSettingsId = 0;
}
if ($userSettingsId > 0) {
if ($arUserSettings["IBLOCK_ID"] != $iblockId || $arUserSettings["TASK_TYPE"] != $taskType || $arUserSettings["OWNER_ID"] != $ownerId) {
$userSettingsId = 0;
$userTemplateId = "";
$arUserSettings = false;
}
}
}
}
if ($userSettingsId <= 0) {
$viewId = 0;
$action = "create";
}
$arResult["Perms"]["CanModifyCommon"] = $taskType == 'user' && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $ownerId, "tasks", 'modify_common_views') || $taskType == 'group' && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $ownerId, "tasks", 'modify_common_views');
if ($action == "edit" && $userSettingsId > 0 && $arUserSettings["COMMON"] != "N") {
if (!$arResult["Perms"]["CanModifyCommon"]) {
$viewId = 0;
$action = "create";
}
}
if ($arParams["SET_TITLE"] == "Y") {
if ($action == "create") {
$APPLICATION->SetTitle(GetMessage("INTV_CREATE_TITLE"));
} else {
$APPLICATION->SetTitle(Str_Replace("#NAME#", $arUserTemplate["NAME"], GetMessage("INTV_EDIT_TITLE")));
}
}
$arResult["MODE"] = $action;
if (StrLen($userTemplateId) > 0) {
示例13: getGroupFeatureAccess
public static function getGroupFeatureAccess($arFields)
{
global $arSocNetFeaturesSettings;
$groupID = intval($arFields["GROUP_ID"]);
$feature = trim($arFields["FEATURE"]);
$operation = trim($arFields["OPERATION"]);
if ($groupID <= 0)
{
throw new Exception("Wrong socialnetwork group ID");
}
if (
strlen($feature) <= 0
|| !array_key_exists($feature, $arSocNetFeaturesSettings)
|| !array_key_exists("allowed", $arSocNetFeaturesSettings[$feature])
|| !in_array(SONET_ENTITY_GROUP, $arSocNetFeaturesSettings[$feature]["allowed"])
)
{
throw new Exception("Wrong feature");
}
if (
strlen($operation) <= 0
|| !array_key_exists("operations", $arSocNetFeaturesSettings[$feature])
|| !array_key_exists($operation, $arSocNetFeaturesSettings[$feature]["operations"])
)
{
throw new Exception("Wrong operation");
}
return CSocNetFeaturesPerms::CurrentUserCanPerformOperation(SONET_ENTITY_GROUP, $groupID, $feature, $operation);
}
示例14: array
if (!$GLOBALS["USER"]->IsAuthorized())
$arResult[0] = "*";
elseif (!check_bitrix_sessid())
$arResult[0] = "*";
elseif ($action == "add_comment")
{
$log_id = $_REQUEST["log_id"];
if ($arLog = CSocNetLog::GetByID($log_id))
{
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arLog["EVENT_ID"]);
if ($arCommentEvent)
{
$feature = CSocNetLogTools::FindFeatureByEventID($arCommentEvent["EVENT_ID"]);
if ($feature && array_key_exists("OPERATION_ADD", $arCommentEvent) && strlen($arCommentEvent["OPERATION_ADD"]) > 0)
$bCanAddComments = CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arLog["ENTITY_TYPE"], $arLog["ENTITY_ID"], ($feature == "microblog" ? "blog" : $feature), $arCommentEvent["OPERATION_ADD"], $bCurrentUserIsAdmin);
else
$bCanAddComments = true;
if ($bCanAddComments)
{
// add source object and get source_id, $source_url
$arParams = array(
"PATH_TO_SMILE" => $_REQUEST["p_smile"],
"PATH_TO_USER_BLOG_POST" => $_REQUEST["p_ubp"],
"PATH_TO_GROUP_BLOG_POST" => $_REQUEST["p_gbp"],
"PATH_TO_USER_MICROBLOG_POST" => $_REQUEST["p_umbp"],
"PATH_TO_GROUP_MICROBLOG_POST" => $_REQUEST["p_gmbp"],
"BLOG_ALLOW_POST_CODE" => $_REQUEST["bapc"]
);
$parser = new logTextParser(LANGUAGE_ID, $arParams["PATH_TO_SMILE"]);
示例15: ParseDateTime
if ($arUser['PERSONAL_BIRTHDAY']) {
$arBirthDate = ParseDateTime($arUser['PERSONAL_BIRTHDAY'], CSite::GetDateFormat('SHORT'));
$arUser['IS_BIRTHDAY'] = intval($arBirthDate['MM']) == date('n') && intval($arBirthDate['DD']) == date('j');
}
$arUser['IS_FEATURED'] = CIntranetUtils::IsUserHonoured($arUser['ID']);
$arUser['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
$arResult["SEARCH"][$i]["USER"] = $arUser;
}
}
}
$arResult['USER_PROP'] = array();
$arRes = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("USER", 0, LANGUAGE_ID);
if (!empty($arRes)) {
foreach ($arRes as $key => $val) {
$arResult['USER_PROP'][$val["FIELD_NAME"]] = strLen($val["EDIT_FORM_LABEL"]) > 0 ? $val["EDIT_FORM_LABEL"] : $val["FIELD_NAME"];
}
}
}
$arrDropdown = array();
$arResult["DROPDOWN_SONET"] = array();
$EntityType = array_key_exists("arrFILTER", $arParams) && in_array("socialnetwork_group", $arParams["arrFILTER"]) ? SONET_ENTITY_GROUP : SONET_ENTITY_USER;
$EntityID = $EntityType == SONET_ENTITY_GROUP ? $arParams["arrFILTER_socialnetwork"][0] : $arParams["arrFILTER_socialnetwork_user"];
$arActiveFeaturesNames = CSocNetFeatures::GetActiveFeaturesNames($EntityType, $EntityID);
foreach ($arParams["arrWHERE_SONET"] as $feature_id) {
if (strlen($feature_id) > 0 && array_key_exists($feature_id, $arActiveFeaturesNames) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $EntityType, $EntityID, $feature_id, $arSocNetFeaturesSettings[$feature_id]["minoperation"][0], CSocNetUser::IsCurrentUserModuleAdmin()) && array_key_exists($feature_id, $arSocNetFeaturesSettings)) {
$arrDropdown[$feature_id] = strlen($arActiveFeaturesNames[$feature_id]) > 0 ? $arActiveFeaturesNames[$feature_id] : GetMessage("SEARCH_CONTENT_TYPE_" . strtoupper($feature_id) . "_" . $EntityType);
}
}
if (count($arrDropdown) > 0) {
$arResult["DROPDOWN_SONET"] = htmlspecialcharsex($arrDropdown);
}