Find a permission by its name (and optionally guardName).

@param string $name
@param string|null $guardName

@throws \Konekt\Acl\Exceptions\PermissionDoesNotExist

@return \Konekt\Acl\Contracts\Permission
517507
public static function findByName(string $name, $guardName = null): PermissionContract
    {
        $guardName = $guardName ?? Guard::getDefaultName(static::class);

        $permission = static::getPermissions()->where('name', $name)->where('guard_name', $guardName)->first();

        if (! $permission) {
            throw PermissionDoesNotExist::create($name, $guardName);
        }

        return $permission;
    }
388012
public function getAuthItem($name)
	{
		$row=$this->db->createCommand()
			->select()
			->from($this->itemTable)
			->where('name=:name', array(':name'=>$name))
			->queryRow();

		if($row!==false)
		{
			if(($data=@unserialize($row['data']))===false)
				$data=null;
			return new CAuthItem($this,$row['name'],$row['type'],$row['description'],$row['bizrule'],$data);
		}
		else
			return null;
	}
860267
public function getCommandNamed($name)
    {
        foreach ($this->commands as $command) {
            if ($name === $command->getName()) {
                return $command;
            }
        }

        throw new DcGeneralInvalidArgumentException('Command with name ' . $name . ' not found');
    }
288954
public function isPublic($name)
    {
        // If route not exists, return NULL
        if (($permissions = $this->getPermissions($name)) === null) {
            return null;
        }

        return count($permissions) === 0;
    }
129117
public function get($name): ?Lock
    {
        if (isset($this->list[$name])) {
            return $this->list[$name];
        } else {
            return null;
        }
    }
45
public function checks($name, $arg = null) {
        if (empty($arg)) {
            $this->checks[] = $name;
        } else {
            $this->checks[$name] = $arg;
        }
        return $this;
    }
181310
public function setPermission($name, $description = null)
    {
        $permission = $this->getPermission($name) ?: $this->createPermission($name);
        if ($description) {
            $permission->description = $description;
        }
        $this->add($permission);

        return $permission;
    }
188486
def find_permission(self, name):
        
        return (
            self.get_session.query(self.permission_model).filter_by(name=name).first()
        )
1067969
public function getBlockByName($name) {
		foreach($this->blockManifest as $block) {
			if($block->getName() == $name) {
				return $block;
			}
		}
		return false;
	}
606347
public function getByName($name)
    {
        return isset($this->loggers[$name]) ? $this->loggers[$name] : null;
    }
1324860
public function block($name, $default = null)
    {
        return isset($this->blocks[$name]) ? $this->blocks[$name] : $default;
    }
105031
public function hasPermission($name, $requireAll = false)
    {
        if (is_array($name)) {
            foreach ($name as $permissionName) {
                $hasPermission = $this->hasPermission($permissionName);
                if ($hasPermission && !$requireAll) {
                    return true;
                } elseif (!$hasPermission && $requireAll) {
                    return false;
                }
            }
            // If we've made it this far and $requireAll is FALSE, then NONE of the permissions were found
            // If we've made it this far and $requireAll is TRUE, then ALL of the permissions were found.
            // Return the value of $requireAll;
            return $requireAll;
        } else {
            foreach ($this->perms as $permission) {
                if ($permission->name == $name) {
                    return true;
                }
            }
        }

        return false;
    }
635189
function guard($authorizeOfGuardName)
    {
        if (! $this->guards->has($authorizeOfGuardName) )
            throw new \Exception(sprintf('Guard Authorization (%s) Not Registered.', $authorizeOfGuardName));

        $guard = $this->guards->get($authorizeOfGuardName);
        return $guard;
    }
1073349
protected function createPermission($name, $readableName)
    {
        // No need to check is_null($permission) as create() throwsException
        $permission = $this->permissionRepository->create($name, $readableName);

        $this->info('Permission created successfully');

        return $permission;
    }
848137
public function getAuth($name = null)
    {
        if ($name !== null) {
            return isset($this->authParams[$name]) ? $this->authParams[$name] : null;
        }

        return $this->authParams;
    }
429546
public function guarded($guard = null)
	{
		if(!$this->isAuthGuarded())
		{
			if(is_null($guard))
				$guard = $this->guard;

			$this->user = $this->users()->findOrFail(Auth::guard($guard)->user()->id);
		}

		return $this;
	}
483957
protected function delegate($name, ...$args)
    {
        if (!count($args)) {
            $args[] = $this->getData();
        }

        $name = str_replace('.', '_', $name);

        $name = StringNormalise::toCamelCase($name);

        if (is_callable([$this, $name])) {
            return $this->$name(...$args);
        }

        return null;
    }