Check whether the current is allowed to see this action (against ACL).
@deprecated Wrong layer. Should be called at the level of the controller
@return bool true if access is granted
326383
public function hasAccess() {

        \common_Logger::w('Call to deprecated method ' . __METHOD__ . ' in ' . __CLASS__);

        $access = true;
        if (!empty($this->data['url'])) {
			$access = tao_models_classes_accessControl_AclProxy::hasAccess(
				$this->data['action'],
				$this->data['controller'],
				$this->data['extension']
			);
        }
        return $access;
    }
438015
public function canAccessAction(string $controllerName, string $action): bool
    {
        if (isset($this->actions[$controllerName][$action])) {
            if (!$this->actions[$controllerName][$action]) {
                return true;
            }

            foreach ($this->actions[$controllerName][$action] as $role) {
                if ($this->hasRoleWithName($role)) {
                    return true;
                }
            }

            return false;
        }

        return $this->canAccessController($controllerName);
    }
696187
private function _checkAcl()
	{
		$aclConfig = Agl::app()->getConfig('core-layout/modules/' . $this->_module . '#' . $this->_view . '#action#' . $this->_action . '/acl');

		if ($aclConfig === NULL) {
			$aclConfig = Agl::app()->getConfig('core-layout/modules/' . $this->_module . '#' . $this->_view . '/acl');
		}

		if ($aclConfig === NULL) {
			$aclConfig = Agl::app()->getConfig('core-layout/modules/' . $this->_module . '/acl');
		}

    	if ($aclConfig !== NULL) {
			$auth = Agl::getAuth();
			$acl  = Agl::getSingleton(Agl::AGL_CORE_POOL . '/auth/acl');
			if (! $acl->isAllowed($auth->getRole(), $aclConfig)) {
	    		$acl->requestLogin();
	    	}
        }

        return true;
	}
172411
public function canAccess()
    {
        if (!$this->app->make('config')->get('concrete.updates.enable_permissions_protection')) {
            return true; // we have turned this off temporarily which means anyone even non-logged-in users can run update.
        }

        $p = new Checker();

        return $p->canUpgrade();
    }
1370357
function isAllowed(/*iAuthResource*/ $resource = null, /*iIdentity*/ $role = null)
    {
        $role = ($role) ?: $this->getAuthAdapter()->identity();

        if (!is_object($resource)
            || (!$resource instanceof PermResource || !method_exists($resource, 'getRouteName'))
        )
            throw new \Exception('Invalid Resource Type, Can`t Check The Permissions.');

        // All has access on home, but authorized users has access on other routes
        return ($resource->getRouteName() == 'home' || $role->hasAuthenticated());
    }
63082
protected function doesCurrentUserHaveAccess()
    {
        // Admins have access by default
        if (Craft::$app->user->getIsAdmin())
        {
            return true;
        }

        // User has the right permission
        if (Craft::$app->user->checkPermission(Patrol::MAINTENANCE_MODE_BYPASS_PERMISSION))
        {
            return true;
        }

        return false;
    }
61653
protected function isInPreviewMode()
    {
        return $this->admin->supportsPreviewMode()
        && ($this->isPreviewRequested()
            || $this->isPreviewApproved()
            || $this->isPreviewDeclined());
    }
898046
protected function canShowByType(int $access_level): bool
    {
        // Hide a family if any member is private
        preg_match_all('/\n1 (?:CHIL|HUSB|WIFE) @(' . Gedcom::REGEX_XREF . ')@/', $this->gedcom, $matches);
        foreach ($matches[1] as $match) {
            $person = Individual::getInstance($match, $this->tree);
            if ($person && !$person->canShow($access_level)) {
                return false;
            }
        }

        return true;
    }
623673
public function canShow(int $access_level = null): bool
    {
        $access_level = $access_level ?? Auth::accessLevel($this->tree);

        // We use this value to bypass privacy checks. For example,
        // when downloading data or when calculating privacy itself.
        if ($access_level === Auth::PRIV_HIDE) {
            return true;
        }

        $cache_key = 'canShow' . $this->xref . ':' . $this->tree->id() . ':' . $access_level;

        return app('cache.array')->rememberForever($cache_key, function () use ($access_level) {
            return $this->canShowRecord($access_level);
        });
    }
1319386
public function isReadableForCurrentMember()
	{
		if ($this->generalReadPermission == self::GENERAL_READ_PERMISSION_ALL)
		{
			return true;
		}
		else if ($this->generalReadPermission == self::GENERAL_READ_PERMISSION_LOGGED_USER && FE_USER_LOGGED_IN)
		{
			return true;
		}
		else if ($this->generalReadPermission == self::GENERAL_READ_PERMISSION_CUSTOM && FE_USER_LOGGED_IN)
		{
			return $this->isAccessibleForCurrentMember(\AccessRight::READ);
		}
		else if ($this->generalReadPermission == self::GENERAL_READ_PERMISSION_INHERIT && $this->hasParentCategory())
		{
			return $this->parentCategory->isReadableForCurrentMember();
		}
		return false;
	}
713207
protected function checkAccess()
    {
        //\Yii::$app->user->can(CmsManager::PERMISSION_ADMIN_ACCESS) version > 2.0.13
        if (\Yii::$app->user->can(CmsManager::PERMISSION_CONTROLL_PANEL)) {
            if (!BackendComponent::getCurrent() && (!\Yii::$app->controller instanceof BackendController) && !in_array(\Yii::$app->controller->module->id,
                    ['debug', 'gii'])) {
                return true;
            }
        }
        /*$ip = Yii::$app->getRequest()->getUserIP();

        foreach ($this->allowedIPs as $filter) {
            if ($filter === '*' || $filter === $ip || (($pos = strpos($filter, '*')) !== false && !strncmp($ip, $filter, $pos))) {
                return true;
            }
        }
        Yii::warning('Не разрешено запускать панель с этого ip ' . $ip, __METHOD__);*/
        return false;
    }
146424
public function showHelpOverlay()
    {
        $result = false;
        if (Config::get('concrete.misc.help_overlay')) {
            $u = new ConcreteUser();
            $timestamp = $u->config('MAIN_HELP_LAST_VIEWED');
            if (!$timestamp) {
                $result = true;
            }
        }

        return $result;
    }
1099824
protected function hasRole()
    {
        $request = $this->request;
        $role = $this->getAction('is');

        return ! $this->forbiddenRoute() && $request->user()->hasRole($role);
    }
650725
public function canAccess()
    {
        // Admin can access everything, no point in checking.
        $member = Security::getCurrentUser();
        if ($member
            && (Permission::checkMember($member, [
                'ADMIN', // Full administrative rights
                'CMS_ACCESS_LeftAndMain', // Access to all CMS sections
                'CMS_ACCESS_CMSMain', // Access to CMS controllers
            ]))
        ) {
            return true;
        }

        // Check if we have access to current section on the current subsite.
        $accessibleSites = $this->owner->sectionSites(true, 'Main site', $member);
        return $accessibleSites->count() && $accessibleSites->find('ID', SubsiteState::singleton()->getSubsiteId());
    }
983293
public function canSwitchUser()
    {
        if ($this->getUser()->isGuest) {
            return false;
        }

        $allowSwitchUser = false;

        $rule = new AccessRule($this->ruleUserSwitch);

        /** @var Controller $userController */
        $userController = null;
        $controller = $this->module->createController('user');
        if (isset($controller[0]) && $controller[0] instanceof UserController) {
            $userController = $controller[0];
        }

        //check by rule
        if ($userController) {
            $action = $userController->createAction('set-identity');
            $user = $this->userSwitch->getMainUser();
            $request = Yii::$app->request;

            $allowSwitchUser = $rule->allows($action, $user, $request) ?: false;
        }

        return $allowSwitchUser;
    }
1317728
public function isAvailable()
    {
        $isDebugging = $this->_logger->isHandling(ehough_epilog_Logger::DEBUG);

        if (! function_exists('fopen')) {

            if ($isDebugging) {

                $this->_logger->debug('fopen() is not available.');
            }

            return false;
        }

        if (function_exists('ini_get') && ini_get('allow_url_fopen') != true) {

            if ($isDebugging) {

                $this->_logger->debug('allow_url_fopen is set to false.');
            }

            return false;
        }

        return true;
    }
1187744
public function isVisible()
    {
        if ((!is_array($this->url)) || (!$this->visible)) { // if it's not array, or not visible then just return visible value, no need to check anything
            return $this->visible;
        }
        $controller = isset($this->url[0]) ? $this->url[0] : 'home';
        $action = isset($this->url[1]) ? $this->url[1] : null;
        if (false !== strpos($controller, '/')) {
            list ($module, $controller) = explode('/', $controller, 2);
            if ('..' == $module) {
                $module = '/';
            }
        } else {
            $module = (isset($this->url[2]) && is_string($this->url[2])) ? $this->url[2] : (isset($this->url[3]) ? $this->url[3] : null);
        }
        if (\mpf\WebApp::get()->accessMap && (!\mpf\WebApp::get()->accessMap->canAccess($controller, $action, $module))) {
            return false;
        }
        return true;
    }