• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/componenthelper.php
  • Класс: BitrixSocialnetworkComponentHelper
  • Вызов: ComponentHelper::checkCanCommentInWorkgroup
static function checkCanCommentInWorkgroup($params)
{
	static $canCommentCached = [];

	$userId = (isset($params['userId']) ? (int)$params['userId'] : 0);
	$workgroupId = (isset($params['workgroupId']) ? (int)$params['workgroupId'] : 0);
	if (
		$userId <= 0
		|| $workgroupId <= 0
	)
	{
		return false;
	}

	$cacheKey = $userId.'_'.$workgroupId;

	if (!isset($canCommentCached[$cacheKey]))
	{
		$canCommentCached[$cacheKey] = (
			CSocNetFeaturesPerms::canPerformOperation($userId, SONET_ENTITY_GROUP, $workgroupId, "blog", "premoderate_comment")
			|| CSocNetFeaturesPerms::canPerformOperation($userId, SONET_ENTITY_GROUP, $workgroupId, "blog", "write_comment")
		);
	}

	return $canCommentCached[$cacheKey];
}