Finds the permission or throws an exception if it is not found.

@param  string $name
@return Permission|null
357420
protected function findPermission($name)
    {
        $permission = $this->authManager->getPermission($name);

        if ($permission instanceof Permission) {
            return $permission;
        }

        return null;
    }
979373
public function findPermissionByKey($key)
    {
        if ($key instanceof PermissionInterface) {
            return $key;
        }

        $result =   $this->permissionProvider->findByKey($key);
        if ($result) {
            return $result;
        }

        $exceptionMessage   =   "The permission '%(key)s' cannot be found.";

        throw new PermissionNotFound(isprintf($exceptionMessage, compact('key')));
    }
803847
public function find($name)
  {
    try
    {
      return parent::find($name);
    }
    catch(\Throwable $e)
    {
      $command = $this->getCommandByString($name, true);
      if($command !== null)
      {
        $this->add($command);
        return $this->get($name);
      }
      throw $e;
    }
  }
181310
public function setPermission($name, $description = null)
    {
        $permission = $this->getPermission($name) ?: $this->createPermission($name);
        if ($description) {
            $permission->description = $description;
        }
        $this->add($permission);

        return $permission;
    }
121823
public function getChild($name)
    {
        $path = $this->path.'/'.$name;

        if (!file_exists($path)) {
            throw new NotFound('File could not be located');
        }
        if ('.' == $name || '..' == $name) {
            throw new Forbidden('Permission denied to . and ..');
        }
        if (is_dir($path)) {
            return new self($path, $this->acl, $this->owner);
        } else {
            return new File($path, $this->acl, $this->owner);
        }
    }
704872
public function getDirective($name)
    {
        if (!$this->initialized) {
            $this->initialize();
        }

        return isset($this->directives[$name]) ? $this->directives[$name] : null;
    }
429360
public function find(string $name)
    {
        if (! \array_key_exists($name, $this->keyMap)) {
            throw new InvalidArgumentException("Name [{$name}] is not available.");
        }

        return $this->controls[$this->keyMap[$name]];
    }
1061944
public function can($name)
    {
        foreach ($this->permissions as $permission) {
            if ($permission->name == $name || $permission->id == $name) {
                return true;
            }
        }

        return false;
    }
1232992
protected function findRole($name)
    {
        $role = $this->authManager->getRole($name);

        if ($role instanceof Role) {
            return $role;
        }

        return null;
    }
448036
public function findActionByName(string $name)
    {
        foreach ($this->actions as $action) {
            if ($action->getAction() === $name) {
                return $action;
            }
        }

        return null;
    }
1172649
public function find($name)
    {

        if (strpos($name, '::') !== false) {
            return $this->findNamedPathView($name);
        }
        return $this->findInPaths($name, $this->paths);
    }
52734
public static function get($name)
	{
		return isset(self::$configParams[$name])
			? self::$configParams[$name]
			: null;
	}
1130018
public function getRule($name)
    {
        if ($this->hasRule($name)) {
            return $this->rules[$name];
        }

        throw new \InvalidArgumentException(sprintf('No rule with name "%s" could be found', $name));
    }
865031
public function getDirective($name)
    {
        foreach ($this->getDirectives() as $directive) {
            if ($directive->getName() === $name) {
                return $directive;
            }
        }
        return NULL;
    }
435867
public function iSeeRole( $name )
    {
        $role = $this->getRoleManager()->getRole( $name );
        Assertion::assertNotNull(
            $role,
            "Couldn't find Role with name $name"
        );
    }
1047444
public function get($name)
    {
        return isset($this->value[$name])
            ? $this->value[$name]
            : null;
    }
355350
public function findWithPermission($permission)
    {
        return array_filter(
            $this->findAll(),
            function ($user) use ($permission) {
                return $user->has($permission);
            }
        );
    }