core-bundle/src/Resources/contao/classes/BackendUser.php
public function isAllowed($int, $row)
	{
		if ($this->isAdmin)
		{
			return true;
		}

		// Inherit CHMOD settings
		if (!$row['includeChmod'])
		{
			$pid = $row['pid'];

			$row['chmod'] = false;
			$row['cuser'] = false;
			$row['cgroup'] = false;

			$objParentPage = PageModel::findById($pid);

			while ($objParentPage !== null && $row['chmod'] === false && $pid > 0)
			{
				$pid = $objParentPage->pid;

				$row['chmod'] = $objParentPage->includeChmod ? $objParentPage->chmod : false;
				$row['cuser'] = $objParentPage->includeChmod ? $objParentPage->cuser : false;
				$row['cgroup'] = $objParentPage->includeChmod ? $objParentPage->cgroup : false;

				$objParentPage = PageModel::findById($pid);
			}

			// Set default values
			if ($row['chmod'] === false)
			{
				$row['chmod'] = Config::get('defaultChmod');
			}
			if ($row['cuser'] === false)
			{
				$row['cuser'] = (int) Config::get('defaultUser');
			}
			if ($row['cgroup'] === false)
			{
				$row['cgroup'] = (int) Config::get('defaultGroup');
			}
		}

		// Set permissions
		$chmod = StringUtil::deserialize($row['chmod']);
		$chmod = \is_array($chmod) ? $chmod : array($chmod);
		$permission = array('w'.$int);

		if (\in_array($row['cgroup'], $this->groups))
		{
			$permission[] = 'g'.$int;
		}

		if ($row['cuser'] == $this->id)
		{
			$permission[] = 'u'.$int;
		}

		return \count(array_intersect($permission, $chmod)) > 0;
	}
public function isAllowed($int, $row)
	{
		if ($this->isAdmin)
		{
			return true;
		}

		// Inherit CHMOD settings
		if (!$row['includeChmod'])
		{
			$pid = $row['pid'];

			$row['chmod'] = false;
			$row['cuser'] = false;
			$row['cgroup'] = false;

			$objParentPage = PageModel::findById($pid);

			while ($objParentPage !== null && $row['chmod'] === false && $pid > 0)
			{
				$pid = $objParentPage->pid;

				$row['chmod'] = $objParentPage->includeChmod ? $objParentPage->chmod : false;
				$row['cuser'] = $objParentPage->includeChmod ? $objParentPage->cuser : false;
				$row['cgroup'] = $objParentPage->includeChmod ? $objParentPage->cgroup : false;

				$objParentPage = PageModel::findById($pid);
			}

			// Set default values
			if ($row['chmod'] === false)
			{
				$row['chmod'] = Config::get('defaultChmod');
			}
			if ($row['cuser'] === false)
			{
				$row['cuser'] = (int) Config::get('defaultUser');
			}
			if ($row['cgroup'] === false)
			{
				$row['cgroup'] = (int) Config::get('defaultGroup');
			}
		}

		// Set permissions
		$chmod = StringUtil::deserialize($row['chmod']);
		$chmod = \is_array($chmod) ? $chmod : array($chmod);
		$permission = array('w'.$int);

		if (\in_array($row['cgroup'], $this->groups))
		{
			$permission[] = 'g'.$int;
		}

		if ($row['cuser'] == $this->id)
		{
			$permission[] = 'u'.$int;
		}

		return \count(array_intersect($permission, $chmod)) > 0;
	}
Return true if the current user is allowed to do the current operation on the current page

@param integer $int
@param array   $row

@return boolean