Documentation

hasAccessForSite

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

Returns true, when current user has access to site as per specified type.

Parameter

Class Description Available from version
siteId Site ID.
accessType Type for which access permissions are checked:
  • denied - access denied
  • read – read access (automatically assigned by the system when additionally indicating any other access permission other than denied)
  • edit – edit access (for page content)
  • sett – setting edit access
  • public – publishing access
  • delete – deleting access (for removing to 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 new site';
   }
}


© «Bitrix24», 2001-2024