Check if a Permission is owned, use permission name.

@param string $permissionName

@return bool
485747
public function canByName(string $permissionName): bool
    {
        if (\in_array($permissionName, \array_column($this->permission, 'name'), true)) {
            return true;
        }

        return false;
    }
1243888
public static function SplitPermission($PermissionName) {
      $i = strpos($PermissionName, '.');
      $j = strrpos($PermissionName, '.');
      
      if($i !== FALSE) { // $j must also not be false
         return array(substr($PermissionName, 0, $i), substr($PermissionName, $i + 1, $j - $i - 1), substr($PermissionName, $j + 1));
      } else {
         return array($PermissionName, '', '');
      }
   }
241325
public function hasPermission($permission)
    {
        if ($permission instanceof Permission) {
            $permission = $permission->name;
        }
        return $this->getRoleSet()->has_permission($permission);
    }
803668
public function owns($thing, $foreignKeyName = null)
    {
        if ($user = $this->user()) {
            return $user->owns($thing, $foreignKeyName);
        }

        return false;
    }
1086180
public function assignPermission($permissionId = null)
    {
        $permissions = $this->permissions;

        if (! $permissions->contains($permissionId)) {
            $this->permissions()->attach($permissionId);

            return true;
        }

        return false;
    }
263987
public function hasDirectPermission($permission): bool
    {
        $permissionClass = $this->getPermissionClass();

        if (is_string($permission)) {
            $permission = $permissionClass->findByName($permission, $this->getDefaultGuardName());
            if (! $permission) {
                return false;
            }
        }

        if (is_int($permission)) {
            $permission = $permissionClass->findById($permission, $this->getDefaultGuardName());
            if (! $permission) {
                return false;
            }
        }

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

        return $this->permissions->contains('id', $permission->id);
    }
371013
public static function isUser(string $username): bool {
		$userdbname = setup::getValidation("username");
		if (R::findOne('user', ' ' . $userdbname . ' = ? ', [$username])) {
			return true;
		}

		return false;
	}
103422
protected function allows($permissionName)
    {
        foreach ($this->getMatchingPermissions($permissionName) as $key)
        {
            /** @var Permission $permission */
            $permission = $this->permissions->get($key);

            if ($permission->isAllowed())
            {
                return true;
            }
        }

        return false;
    }
196638
public function matchesPermission(Permission $permission)
    {
        return (
            $this instanceof $permission &&
            $this->action === $permission->getAction() && // Not using matchesAction to avoid the wildcard
            $this->matchesResource($permission->getResource())
        );
    }
1004802
public function hasPermission($permission)
    {
        $permission = !is_string($permission) ?: Permission::where(['slug' => $permission])->first();
        
        if (config('laralum.superadmin_bypass_haspermission')) {
            return true;
        }
        
        if ($permission) {
            foreach ($this->roles as $role) {
                if ($role->hasPermission($permission)) {
                    return true;
                }
            }
        }

        return false;
    }
337805
public function permission($permission): bool
    {
        $perms = fileperms($this->getAbsoluteFilePath());

        switch ($permission) {
            case FilePermission::READ_OWNER:
                return (($perms & 0x0100) ? true : false);

            case FilePermission::WRITE_OWNER:
                return (($perms & 0x0080) ? true : false);

            case FilePermission::EXE_OWNER:
                return (($perms & 0x0040) ?
                    (($perms & 0x0800) ? null /* 's' */ : true) :
                    (($perms & 0x0800) ? null /* 'S' */ : false));

            case FilePermission::READ_USER:
                return $this->isReadable();

            case FilePermission::WRITE_USER:
                return $this->isWritable();

            case FilePermission::EXE_USER:
                return $this->isExecutable();

            case FilePermission::READ_GROUP:
                return (($perms & 0x0020) ? true : false);

            case FilePermission::WRITE_GROUP:
                return (($perms & 0x0010) ? true : false);

            case FilePermission::EXE_GROUP:
                return (($perms & 0x0008) ?
                    (($perms & 0x0400) ? null /* 's' */ : true) :
                    (($perms & 0x0400) ? null /* 'S' */ : false));

            case FilePermission::READ_OTHER:
                return (($perms & 0x0004) ? true : false);

            case FilePermission::WRITE_OTHER:
                return (($perms & 0x0002) ? true : false);

            case FilePermission::EXE_OTHER:
                return (($perms & 0x0001) ?
                    (($perms & 0x0200) ? null /* 't' */ : true) :
                    (($perms & 0x0200) ? null /* 'T' */ : false));
        }

        return true;
    }
425270
protected function checkAccess($permission): bool
    {
        return $this->app->core->user->permissions[$this->app->getName()]->allowedTo($permission);
    }
281138
public function hasPermission($permission)
    {
        if (!is_array($this->permissionsMap)) {
            $permissionsMap = cache()->get('permissions:' . $this->id, null);
            if ($permissionsMap === null) { // Not in cache
                $this->permissionsMap = $this->buildPermissionsMap();
                cache()->forever('permissions:' . $this->id, $this->permissionsMap);
            } else {
                $this->permissionsMap = $permissionsMap;
            }
        }
        return in_array($permission, $this->permissionsMap);
    }
110666
public function hasPermissionTo($permission): bool
    {
        // Check role flags
        if ($this->hasPermissionFlags()) {
            return $this->hasPermissionThroughFlag();
        }

        // Check role permissions
        if ($this->hasPermissionThroughRole($permission)) {
            return true;
        }

        // Check user permission
        if ($this->hasPermission($permission)) {
            return true;
        }

        return false;
    }
783740
public function isGranted($permission, $context = null)
    {
        $roles = $this->roleService->getIdentityRoles();

        if (empty($roles)) {
            return false;
        }

        if (!$this->rbac->isGranted($roles, $permission)) {
            return false;
        }

        if ($this->hasAssertion($permission)) {
            return $this->assert($this->assertions[(string) $permission], $context);
        }

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

        return false;
    }
148998
public function hasPermission($permission)
    {
        if (!$permission) {
            return false;
        }
        foreach ($this->permissions as $perm) {
            if ($perm->name == $permission) {
                return true;
            }
        }
        return false;
    }