Determines whether the given ability allows an action on all models.

@param  \Illuminate\Database\Eloquent\model  $ability
@return bool
434047
protected function isGlobalActionAbility(Model $ability)
    {
        return $ability->name !== '*'
            && $ability->entity_type === '*'
            && is_null($ability->entity_id);
    }
661170
public function enabled($feature)
    {
        $feature_value = $this->value($feature);

        if (is_null($feature_value)) {
            return false;
        }

        // If value is one of the positive words configured then the
        // feature is enabled.
        if (in_array(strtoupper($feature_value), config('laraplans.positive_words'))) {
            return true;
        }

        return false;
    }
1317746
def can(ability, add_headers=None):
    """"""
    client = ClientMixin(api_key=None)
    try:
        client.request('GET', endpoint='abilities/%s' % ability,
                       add_headers=add_headers)
        return True
    except Exception:
        pass
    return False
185104
public function check($ability, $arguments = array())
    {
        if (! is_array($arguments)) {
            $arguments = array_slice(func_get_args(), 1);
        }

        try {
            $result = $this->raw($ability, $arguments);
        }
        catch (AuthorizationException $e) {
            return false;
        }

        return (bool) $result;
    }
96424
public function can($permission, $all = false)
    {
        if ($this->isPretendEnabled()) {
            return $this->pretend('can');
        }

        return $this->{$this->getMethodName('can', $all)}($permission);
    }
449536
protected function shouldConductLazy($abilities)
    {
        // We'll only create a lazy conductor if we got a single
        // param, and that single param is either a string or
        // a numerically-indexed array (of simple strings).
        if (func_num_args() > 1) {
            return false;
        }

        if (is_string($abilities)) {
            return true;
        }

        if (! is_array($abilities) || ! Helpers::isIndexedArray($abilities)) {
            return false;
        }

        // In an ideal world, we'd be using $collection->every('is_string').
        // Since we also support older versions of Laravel, we'll need to
        // use "array_filter" with a double count. Such is legacy life.
        return count(array_filter($abilities, 'is_string')) == count($abilities);
    }
781672
public function authorize($ability, $arguments = [])
    {
        $result = $this->allows($ability, $arguments);
        return $result ? $this->allow() : $this->deny();
    }
409507
public function isCustomRole(Model $Model, $action = 'create') {
		foreach (array_keys($this->settings[$Model->alias]) as $role) {
			$method = "is" . Inflector::classify($role);
			if (
				!in_array($role, array('owner', 'groups', 'collaborators', 'perms'))
				&& $this->settings[$Model->alias][$role]['allow']
				&& $this->settings[$Model->alias][$role][$action]
				&& $this->{$method}($Model)
			) {
				return true;
			}
		}
		return false;
	}
1298159
public function checkGetId(Model $authority, $ability, $model = null)
    {
        $applicable = $this->compileAbilityIdentifiers($ability, $model);

        // We will first check if any of the applicable abilities have been forbidden.
        // If so, we'll return false right away, so as to not pass the check. Then,
        // we'll check if any of them have been allowed & return the matched ID.
        $forbiddenId = $this->findMatchingAbility(
            $this->getForbiddenAbilities($authority), $applicable, $model, $authority
        );

        if ($forbiddenId) {
            return false;
        }

        return $this->findMatchingAbility(
            $this->getAbilities($authority), $applicable, $model, $authority
        );
    }
17469
protected function getAbilityIds($abilities, $model = null, array $attributes = [])
    {
        if ($abilities instanceof Model) {
            return [$abilities->getKey()];
        }

        if ( ! is_null($model)) {
            return $this->getModelAbilityKeys($abilities, $model, $attributes);
        }

        if (Helpers::isAssociativeArray($abilities)) {
            return $this->getAbilityIdsFromMap($abilities, $attributes);
        }

        if (! is_array($abilities) && ! $abilities instanceof Collection) {
            $abilities = [$abilities];
        }

        return $this->getAbilityIdsFromArray($abilities, $attributes);
    }
1273923
public function unforbid($ability = null, $model = null)
    {
        if (is_null($ability)) {
            return new UnforbidsAbilities($this);
        }

        (new UnforbidsAbilities($this))->to($ability, $model);

        return $this;
    }
344964
public function getAbilities(Model $authority, $allowed = true)
    {
        return Abilities::forAuthority($authority, $allowed)->get();
    }
661373
public function can($permission)
  {
    if (is_array($permission)) {
      return (!! (count($permission) == count(array_intersect($this->permissions()->pluck('name')->toarray(), $permission))));
    } else {
      return in_array($permission, $this->permissions()->pluck('name')->toarray());
    }
  }
917237
protected function isForbidden(Model $authority, $ability, $model = null)
    {
        return $this->getHasAbilityQuery(
            $authority, $ability, $model, $allowed = false
        )->exists();
    }
481345
public function authorize($ability, $arguments = [])
    {
        $result = $this->raw($ability, $arguments);

        if ($result instanceof Response) {
            return $result;
        }

        return $result ? $this->allow() : $this->deny();
    }
561481
public function can($capability, $args = null)
	{
		if (!$this->user())
		{
			return false;
		}

		$userCan = false;

		if (is_array($capability))
		{
			foreach ($capability as $cap)
			{
				// if only one capability is accepted
				if (current_user_can($cap, $args) === true)
				{
					$userCan = true;
					break;
				}
			}
		}
		else
		{
			$userCan = current_user_can($capability, $args);
		}

		return $userCan;
	}
1288860
public function check_capabilities() {
		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) {
			return false;
		}

		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) {
			return false;
		}

		return true;
	}