SetupComponent::isAuthorized()

@return bool Success
765485
public function isAuthorized() {
		if (!Configure::read('Config.productive')) {
			return true;
		}
		$pwd = $this->Controller->request->getQuery('pwd');
		if ($pwd && $pwd === Configure::read('Config.pwd')) {
			return true;
		}
		return false;
	}
1056873
public function isAccessible()
    {
        if ($this->hasAccessRestrictions() === false) {
            return true;
        }

        if ($this->securityContext->canBeInitialized() === false) {
            return true;
        }

        foreach ($this->accessRoles as $roleName) {
            if ($this->securityContext->hasRole($roleName)) {
                return true;
            }
        }

        return false;
    }
518582
public function isAuthorised()
    {

        if (is_array($this->user) === true
            && isset($this->user['error']) === false
        ) {

            return true;
        }

        return $this->getUser();
    }
1363869
protected function hasToBeAuthorized()
    {
        if ( in_array($this->route->getName(), self::$except) ) return false;

        return (bool) $this->route->getName();
    }
853766
public function isAdmin(): bool
    {
        return $this->isLoggedIn()
            && isset($this->session->get('user')['admin'])
            && $this->session->get('user')['admin'] === true;
    }
76379
public function isAuthenticated(): bool
    {
        if (!$this->securityContext->canBeInitialized()) {
            return false;
        }

        return array_reduce($this->securityContext->getAuthenticationTokens(), function (bool $isAuthenticated, TokenInterface $token) {
            return $isAuthenticated || $token->isAuthenticated();
        }, false);
    }
33337
public function initialize()
    {
        if ($this->checkAuthentication()) {
            $data = $this->getAuthenticationData();
            if (!isset($data['user_id'])) {
                return false;
            }

            $user = $this->toolkit->getRepository($this->userClassName)->getById($data['user_id']);
            if (!$user) {
                $this->setAuthenticated(false);
                $this->setAuthenticationData([]);
                return false;
            }
            $this->setUser($user);
            return true;
        }
        return false;
    }
42832
final public function isAuthenticated()
    {

        $self = $this;
        $auth = $self->get("handler", "auth");

        if (is_a($auth, Authenticate::class)) {
            if (isset($auth->authenticated)) {
                return (bool)$auth->authenticated;
            }
        }

        return false;
    }
1184912
public function isAuthorized($user = null) {
		$result = false;
		if (empty($this->prefixes) || !is_array($this->prefixes)) {
			return $result;
		}
		$rolePrefix = (string)$this->_objUserInfo->getUserField('prefix', $user);
		if (!empty($rolePrefix)) {
			if (!in_array($rolePrefix, $this->prefixes)) {
				return $result;
			}
			$prefixes = [$rolePrefix];
		} else {
			$prefixes = $this->prefixes;
		}

		$action = $this->_controller->request->param('action');
		foreach ($prefixes as $prefix) {
			if (mb_stripos($action, $prefix . '_') === 0) {
				$result |= true;
			} else {
				$result |= false;
			}
		}
		if (empty($rolePrefix)) {
			$result = !$result;
		}

		return (bool)$result;
	}
682360
protected function checkAuthentication()
    {
        $authSession = $this->readFromSession();
        if ($authSession) {
            if (isset($authSession['authenticated'])) {
                $this->setAuthenticated($authSession['authenticated']);
            } else {
                $this->setAuthenticated(false);
            }

            if (isset($authSession['data'])) {
                $this->setAuthenticationData($authSession['data']);
            } else {
                $this->setAuthenticationData([]);
            }

            return true;
        }
        return false;
    }
1316517
public function initialise() {
        if ($this->initialised || during_initial_install()) {
            return false;
        }
        $this->context = $this->page->context;
        $this->load_administration_settings();

        // Check if local plugins is adding node to site admin.
        $this->load_local_plugin_settings();

        $this->initialised = true;
    }
438610
public boolean isAuthenticated() {
        try {
            return IS_AUTHENTICATED_AUTHORIZER.isAuthorized(null, getAll(true));
        } catch (final HttpAction e) {
            throw new TechnicalException(e);
        }
    }
369412
protected function shouldSkipAuth()
    {
        $config = b8\Config::getInstance();
        $state = (bool)$config->get('phpci.authentication_settings.state', false);
        $userId    = $config->get('phpci.authentication_settings.user_id', 0);

        if (false !== $state && 0 != (int)$userId) {
            $user = b8\Store\Factory::getStore('User')
                ->getByPrimaryKey($userId);

            if ($user) {
                $_SESSION['phpci_user'] = $user;
                return true;
            }
        }

        return false;
    }
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());
    }
930997
public function check(): bool
    {
        $auth = $this->parseAuthenticationConfiguration(\config('auth'));

        try {
            $this->description = Str::replace($this->description, ['model' => $auth['provider']['model']]);

            return $this->validateUserProvider($auth) && $this->validateUserInstance($auth);
        } catch (ReflectionException $e) {
            // Catch ReflectionException and return false.
        } finally {
            // Catch any exception.
        }

        return false;
    }
97705
public function authorize()
    {
        if (auth()->user()->can('admin')) {
            return true;
        } elseif (auth()->user()->isTeamAdmin($this->route('id'))) {
            return true;
        }

        return false;
    }
1080855
public function isLoggedIn() : bool {

		// Requires a started session
		if (isset($_SESSION["login_token"])) {
			$loginToken = $_SESSION["login_token"];
			return $this->sessionManager->isValidLoginToken($loginToken);
		} else {
			return false;
		}
	}