Determine if the given ability should be denied for the current user.

@param  string $ability
@param  array|mixed $arguments
@return bool
429446
public function denies($ability, $arguments = [])
    {
        if (!is_array($arguments)) {
            $arguments = [ $arguments ];
        }

        array_unshift($arguments, $ability);
        return call_user_func_array([ $this->gatekeeper, 'denies'], $arguments);
    }
461249
public function ability($roles, $permissions, $options = [])
    {
        if ($user = $this->user()) {
            return $user->ability($roles, $permissions, $options);
        }

        return false;
    }
1122452
public function authorizeForUser($user, $ability, $arguments = array())
    {
        list($ability, $arguments) = $this->parseAbilityAndArguments($ability, $arguments);

        $gate = App::make('Nova\Auth\Access\GateInterface')->forUser($user);

        return $this->authorizeAtGate($gate, $ability, $arguments);
    }
82243
protected function callAuthCallback(User $user, $ability, array $arguments)
    {
        $callback = $this->resolveAuthCallback($user, $ability, $arguments);

        return call_user_func_array($callback, array_merge(array($user), $arguments));
    }
434888
public function before(Person $person, $ability)
    {
        if ($person->isSuperUser()) {
            return true;
        }

        if (!$person->hasSite(Router::getActiveSite())) {
            return false;
        }
    }
525261
public function canRun($arguments = [])
    {
        $action = 'action' . ucfirst($this->getActiveAction());
        return $this->canCallMethod($action, $arguments ? $arguments : ($this->request ? $this->request->getParams() : []));
    }
686653
public function can($ability, $model = null)
    {
        return $this->getClipboardInstance()->check($this, $ability, $model);
    }
854228
public function cannot($args = null)
    {
        $args = is_array($args) ? $args : func_get_args();
        return call_user_func_array([$this->getCurrentAuthority(), 'cannot'], $args);
    }
1326130
public function can($ability, $model, $user = false)
    {
        if ($user === false) {
            $user = auth()->user();
        }

        $this->authorized = $user->can($ability, $model, $user);

        return $this;
    }
748645
protected function validateMissingArguments(array $arguments): bool
    {
        $missingArguments = \array_filter($arguments, function ($argument) {
            return empty($this->argument($argument));
        });

        if (\count($missingArguments) > 1) {
            throw new RuntimeException(\sprintf('Not enough arguments (missing: "%s").', \implode(', ', $missingArguments)));
        }

        return true;
    }
781672
public function authorize($ability, $arguments = [])
    {
        $result = $this->allows($ability, $arguments);
        return $result ? $this->allow() : $this->deny();
    }
999025
protected function callAfterCallbacks($user, $ability, array $arguments, $result)
    {
        foreach ($this->afterCallbacks as $after) {
            if (! $this->canBeCalledWithUser($user, $after)) {
                continue;
            }

            $afterResult = $after($user, $ability, $result, $arguments);

            $result = $result ?? $afterResult;
        }

        return $result;
    }
279073
public static function gatekeeper($ability = null) {
    if (!isset(self::$currentUser)) {
      return false;
    }
    return self::$currentUser->gatekeeper($ability);
  }
1252504
public function authorize($ability, $arguments = [])
    {
        if (!$response = app('scaffold.actions')->authorize($ability, $arguments)) {
            throw $this->createGateUnauthorizedException(
                $ability,
                $this->translator->trans('administrator::errors.unauthorized')
            );
        }

        return $response;
    }
110349
public function revoke($ability) {
    if (in_array($ability, $this->abilities)) {
      return $this->abilities =
        array_values(array_diff($this->abilities, [$ability]));
    }
    return true;
  }
893989
public function checkAccess(array $permissions = [], bool $force = false): bool
    {
        // Guests are not allowed by default
        if ($this->isGuest()) {
            return false;
        }

        // Allow access to all users when permissions argument is empty
        if (empty($permissions)) {
            return true;
        }

        // Administrators are supermen :P
        if ($this->isAdmin()) {
            return true;
        }

        // User has the right to do this?
        if (count(array_intersect($permissions, $this->perissions)) > 0) {
            return true;
        }

        // You aren't allowed, by default.
        return false;
    }
496636
public function registerPermissions(array $abilities_permissions)
    {
        try {

            // a callback that is run before all other authorization checks
            if (isset($abilities_permissions['before'])) {
                if (is_array($abilities_permissions['before'])) {
                    $this->runGateBefore($abilities_permissions['before']);
                } else {
                    Log::alert('abilities "before" must be an array, no before policies registered!');
                }
            }

            // Register abilities and their polices
            if (isset($abilities_permissions['abilities'])) {
                if (is_array($abilities_permissions['abilities'])) {
                    $this->runGateDefine($abilities_permissions['abilities']);
                } else {
                    Log::alert('abilities must be an array, no abilities registered!');
                }
            }

            //  you may not modify the result of the authorization check from an after callback
            if (isset($abilities_permissions['after'])) {
                if (is_array($abilities_permissions['after'])) {
                    $this->runGateAfter($abilities_permissions['after']);
                } else {
                    Log::alert('abilities "after" must be an array, no "after" callbacks registered!');
                }
            }

            return true;
        } catch (Exception $e) {
            Log::alert('Could not register abilities .. '.$e);

            return false;
        }
    }