Contao\BackendUser::hasAccess PHP Method

hasAccess() public method

Check whether the current user has a certain access right
public hasAccess ( string $field, array $array ) : boolean
$field string
$array array
return boolean
    public function hasAccess($field, $array)
    {
        if ($this->isAdmin) {
            return true;
        }
        if (!is_array($field)) {
            $field = array($field);
        }
        if (is_array($this->{$array}) && array_intersect($field, $this->{$array})) {
            return true;
        } elseif ($array == 'filemounts') {
            // Check the subfolders (filemounts)
            foreach ($this->filemounts as $folder) {
                if (preg_match('/^' . preg_quote($folder, '/') . '(\\/|$)/i', $field[0])) {
                    return true;
                }
            }
        }
        return false;
    }