3namespace Bitrix\Socialnetwork\Integration\UI\EntitySelector;
5use Bitrix\Main\ArgumentException;
6use Bitrix\Main\Entity\Query;
7use Bitrix\Main\ORM\Fields\Relations\Reference;
8use Bitrix\Main\ORM\Query\Join;
9use Bitrix\Main\SystemException;
10use Bitrix\Main\UserTable;
11use Bitrix\Socialnetwork\Helper\Workgroup;
12use Bitrix\Socialnetwork\UserToGroupTable;
19 $this->options[
'projectId'] = (int)(
$options[
'projectId'] ??
null);
29 if ($projectId <= 0 || !static::isMember($projectId))
31 return static::getEmptyQuery();
34 return parent::getQuery(
$options)->registerRuntimeField(
38 UserToGroupTable::getEntity(),
39 Join::on(
'this.ID',
'ref.USER_ID')
40 ->where(
'ref.GROUP_ID', $projectId)
42 [
'join_type' => Join::TYPE_INNER]
53 private static function isMember(
int $projectId): bool
55 $permissions = Workgroup::getPermissions([
56 'groupId' => $projectId,
57 'userId' => static::getCurrentUserId(),
60 return $permissions[
'UserIsMember'] ??
false;
67 private static function getEmptyQuery():
Query
69 return UserTable::query()->setSelect([
'ID'])->where(
'ID', 0);
static getExtranetUsersQuery(int $currentUserId)
prepareOptions(array $options=[])
static getQuery(array $options=[])
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)