Authorize following the actor.

@return bool
540811
public function canAddfollow()
    {
        if (!$this->actor) {
            return false;
        }

        if (!$this->getItem()) {
            return false;
        }

        return $this->getItem()->authorize('follower', array('viewer' => $this->actor));
    }
173701
public function authorized() {
		// if the rule is public, always authorized
		if ( 'public' === $this->options['rule'] ) {
			return true;
		}

		// enable passing in callback
		if ( 'callback' === $this->options['rule'] && is_callable( $this->options['callback'] ) ) {
			return call_user_func( $this->options['callback'] );
		}

		// map rule to method
		if ( method_exists( $this, $method = $this->options['rule'] ) ) {
			return $this->{$method}();
		}

		// disable in rule is misconfigused
		// @todo set up internal translations
		// @todo also, this error message kinda sucks
		return new WP_Error( '500', __( 'Guard failure', 'jaxion' ) );
	}
152369
protected function _authorizeAdministration(AnCommandContext $context)
    {
        $ret = false;

        if ($this->_entity->authorize('access', $context)) {

            if ($this->_viewer->isAdministrator()) {
                $ret = $this->_viewer->administrator($this->_entity);
            }

            if ($context->strict !== true) {
                $ret = $ret || $this->_viewer->admin();
            }
        }

        return (bool) $ret;
    }
800665
public function authorizeAction()
    {
        $request = $this->getController()->request;
        $action = $request->getParam('action');

        $skipAuthorization = $this->checkAction($action, 'skipAuthorization');
        if ($skipAuthorization) {
            $this->skipAuthorization();

            return;
        }

        $authorizeModel = $this->checkAction($action, 'authorizeModel');
        if ($authorizeModel) {
            $this->authorize($this->getController()->loadModel());
        }
    }
178708
public function getAuthority()
    {
        return ( $this->_user ? $this->_user . '@' : '') . $this->_host . (isset($this->_port) ? ':' . $this->_port : '');
    }
476320
public function authorize()
    {
        $this->assertServiceInstance();

        try {
            $request = $this->di->get('request');
            $code = $request->getQuery('code', null);
            if (!is_null($code)) {
                $state = $request->getQuery('state', null);

                return $this->service->requestAccessToken($code, $state);
            }
        } catch (\OAuth\Common\Exception\Exception $ex) {
            throw new FailedAuthorizationException($ex->getMessage());
        }
    }
837707
public function authorize()
    {
        if (Request::isMethod('post')) {
            return Gate::allows('roles_create');
        }

        if (Request::isMethod('put')) {
            return Gate::allows('roles_update');
        }

        if (Request::isMethod('destory')) {
            return Gate::allows('roles_delete');
        }
    }
580852
public function getAuthorizationMethod()
    {
        if ($this->hasHeader('Authorization')) {
            $authorization = $this->getHeader('Authorization');
            return strstr($authorization, ' ', true);
        }
        return false;
    }
54818
protected function passesAuthorization(): bool
    {
        $passes = false;

        if (\method_exists($this, 'authorize')) {
            $passes = $this->container->call([$this, 'authorize']);
        }

        return (bool) $passes;
    }
1111286
public function canExecute($action)
    {
        if (!$this->actor) {
            return false;
        }

        if (!$this->actor->isNotifiable()) {
            return false;
        }

        if ($this->actor->authorize('access') === false) {
            return false;
        }

        if ($this->actor->authorize('administration') === false) {
            return false;
        }

        return parent::canExecute($action);
    }
578895
public function forAuthorization()
    {
        $this->router->group(['middleware' => ['web', 'auth']], function ($router) {
            $router->get('/authorize', [
                'uses' => 'AuthorizationController@authorize',
            ]);

            $router->post('/authorize', [
                'uses' => 'ApproveAuthorizationController@approve',
            ]);

            $router->delete('/authorize', [
                'uses' => 'DenyAuthorizationController@deny',
            ]);
        });
    }
785117
protected function _authorizeSubscribe($context)
    {
        $entity = $this->_entity;

        if ($this->_viewer->guest()) {
            return false;
        }

        if (!$entity->isSubscribable()) {
            return false;
        }

        //if the owner has blocked the viewer or the other way around, return false

        if ($this->_entity->isOwnable()) {
            if ($this->_entity->owner->blocking($this->_viewer) || $this->_viewer->blocking($this->_entity->owner)) {
                return false;
            }
        }

        //if already subscribed to the node then return false
        if ($entity->subscribed($this->_viewer)) {
            return false;
        }

        return true;
    }
361371
protected function _authorizeAddComment($context)
    {
        if (isset($this->_entity->object)) {
            if (is_array($this->_entity->object)) {
                return false;
            }

            if (!$this->_entity->object->isAuthorizer()) {
                return false;
            }

            return $this->_entity->object->authorize('add.comment');
        } else {
            return false;
        }
    }
599738
public function authorize()
    {
        $this->model = $this->route('message');
        if (is_null($this->model)) {
            // Determine if the user is authorized to access message module,
            return $this->canAccess();
        }

        if ($this->isWorkflow()) {
            // Determine if the user is authorized to change status of an entry,
            return $this->can($this->getStatus());
        }

        if ($this->isCreate() ||  $this->isStore()) {
            // Determine if the user is authorized to create an entry,
            return $this->can('create');
        }

        if ($this->isUpdate() ||  $this->isEdit()) {
            // Determine if the user is authorized to update an entry,
            return $this->can('update');
        }

        if ($this->isDelete()) {
            // Determine if the user is authorized to delete an entry,
            return $this->can('delete');
        }

        // Determine if the user is authorized to view the module.
        return $this->can('view');

    }
629119
public function isAuthorized($user)
    {
        $this->Authorizer->action(['*'], function ($auth, $user) {
            $auth->allowRole([1]);
        });

        return $this->Authorizer->authorize();
    }
458719
async function authorize (action, target) {
    let result = await check(this.auth.credentials && this.auth.credentials.user, action, target)
    if (result !== true) throw Boom.unauthorized(action)
    return true
  }
1072138
public function authorize(): bool
    {
        $twoFactor = $this->user($this->route('guard'))->getTwoFactor();

        if (! $twoFactor['totp']['enabled']) {
            throw new GenericException(trans('cortex/auth::messages.verification.twofactor.totp.cant_backup'), route('adminarea.account.settings'));
        }

        return true;
    }