2namespace Bitrix\Landing\Binding;
4use Bitrix\Landing\Connector\SocialNetwork;
5use \Bitrix\Landing\Role;
6use \Bitrix\Landing\Rights;
7use \Bitrix\Landing\Internals\RightsTable;
8use \Bitrix\Landing\Internals\BindingTable;
31 $res = BindingTable::getList([
36 '=BINDING_TYPE' => self::$bindingType,
37 '=BINDING_ID' => $groupId,
38 '=ENTITY_TYPE' => self::ENTITY_TYPE_SITE,
42 return $res->fetch()[
'ENTITY_ID'] ??
null;
54 if (!\
Bitrix\
Main\Loader::includeModule(
'socialnetwork'))
59 foreach ($input as
$key => $item)
61 if (isset($item[
'ID']))
63 $sitesTitle[$item[
'ID']] =
'';
70 $res = BindingTable::getList([
73 'GROUP_TITLE' =>
'GROUP.NAME',
76 '=BINDING_TYPE' => self::$bindingType,
77 '=ENTITY_TYPE' => self::ENTITY_TYPE_SITE,
78 '=ENTITY_ID' => array_keys($sitesTitle)
83 'Bitrix\Socialnetwork\WorkgroupTable',
91 while ($row =
$res->fetch())
93 $sitesTitle[$row[
'ENTITY_ID']] = $row[
'GROUP_TITLE'];
97 foreach ($input as
$key => &$item)
99 if (isset($item[
'ID']) && $sitesTitle[$item[
'ID']])
101 $item[
'TITLE'] = $sitesTitle[$item[
'ID']];
122 $res = \CTask::getList(
124 [
'MODULE_ID' =>
'landing'],
126 while ($row =
$res->fetch())
128 if ($row[
'LETTER'] >
'D')
130 $row[
'NAME'] = str_replace(
'landing_right_',
'', $row[
'NAME']);
131 $tasks[] = $fullData ? $row : $row[
'ID'];
145 static $roleId =
null;
147 if ($roleId !==
null)
152 $res = Role::getList([
157 '=TYPE' => self::ROLE_TYPE
160 if ($row =
$res->fetch())
162 $roleId = $row[
'ID'];
167 'XML_ID' =>
'MANAGER',
168 'TYPE' => self::ROLE_TYPE
170 if (
$res->isSuccess())
172 $roleId =
$res->getId();
181 return (
int) $roleId;
197 if (!$groupRoles && \
Bitrix\
Main\Loader::includeModule(
'socialnetwork'))
207 $res = \CSocNetFeaturesPerms::getList(
210 'FEATURE_ENTITY_ID' => $this->bindingId,
215 while ($row =
$res->fetch())
217 $groupRoles[$row[
'OPERATION_ID']] = $row[
'ROLE'];
221 foreach ($tasks as $task)
223 if (!isset($groupRoles[$task[
'NAME']]))
227 $check = RightsTable::getList([
234 '=ACCESS_CODE' =>
'SG' . $this->bindingId .
'_' . $groupRoles[$task[
'NAME']],
235 'TASK_ID' => $task[
'ID'],
244 'TASK_ID' => $task[
'ID'],
245 'ACCESS_CODE' =>
'SG' . $this->bindingId .
'_' . $groupRoles[$task[
'NAME']],
260 $opsToRoles = $this->getOperationsToRolesMap($this->bindingId);
274 $res = RightsTable::getList([
281 'ACCESS_CODE' =>
'SG' . $this->bindingId .
'_%',
285 while ($row =
$res->fetch())
287 RightsTable::delete($row[
'ID'])->isSuccess();
297 private function getOperationsToRolesMap(
int $groupId):
array
301 if (!\
Bitrix\
Main\Loader::includeModule(
'socialnetwork'))
306 $res = \CSocNetFeaturesPerms::getList(
309 'FEATURE_ENTITY_ID' => $groupId,
314 while ($row =
$res->fetch())
316 $opsToRoles[$row[
'OPERATION_ID']] = $row[
'ROLE'];
addSiteRights(int $siteId, array $groupRoles=[])
static getAccessTasks(bool $fullData=false)
static getSiteIdByGroupId(int $groupId)
static recognizeSiteTitle(array $input)
updateSiteRights(int $siteId)
removeSiteRights($siteId)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(empty($signedUserToken)) $key