Documentation

hasAccessForSite

Rights::hasAccessForSite(
   $siteId,
   $accessType
);

Returns true, when current user has access to site at the specified type.

Parameters

Parameter Description Available from version
siteId Site identifier./td>
accessType Type with enabled access permissions check:
  • denied - access denied
  • read – read only (this permission is assigned automatically by the system when specifying any permission different from 'denied')
  • edit – edit (for page content)
  • sett – settings edit
  • public – publication
  • delete – deleting (to recycle bin and restoring from recycle bin)

Example

if (\Bitrix\Main\Loader::includeModule('landing'))
{
   if (\Bitrix\Landing\Rights::hasAccessForSite($siteId, 'delete'))
   {
      echo 'You can delete this site';
   }
}

Access permission check for creating a new site:

if (\Bitrix\Main\Loader::includeModule('landing'))
{
   if (\Bitrix\Landing\Rights::hasAccessForSite(0, 'sett'))
   {
      echo 'You can create a new site';
   }
}


© «Bitrix24», 2001-2024