requirePermission(self::PERMISSION_READ); return $this->rules->list(FirewallRuleScope::system(), $activeOnly); } public function queryRules( string $status = 'active', ?string $type = null, ?string $action = null, int $limit = 50, int $offset = 0 ): array { $this->requirePermission(self::PERMISSION_READ); return $this->rules->query(FirewallRuleScope::system(), $status, $type, $action, $limit, $offset); } public function fetchRule(string $ruleId): ?FirewallRuleObject { $this->requirePermission(self::PERMISSION_READ); return $this->rules->fetch(FirewallRuleScope::system(), $ruleId); } public function blockIp(string $ip, ?string $reason = null, ?int $durationSeconds = null): FirewallRuleObject { $this->requirePermission(self::PERMISSION_MANAGE); return $this->rules->blockIp( FirewallRuleScope::system(), $ip, $reason, $this->identity->identifier(), $durationSeconds ); } public function allowIp(string $ip, ?string $reason = null): FirewallRuleObject { $this->requirePermission(self::PERMISSION_MANAGE); return $this->rules->allowIp( FirewallRuleScope::system(), $ip, $reason, $this->identity->identifier() ); } public function blockIpRange(string $cidr, ?string $reason = null): FirewallRuleObject { $this->requirePermission(self::PERMISSION_MANAGE); return $this->rules->blockIpRange( FirewallRuleScope::system(), $cidr, $reason, $this->identity->identifier() ); } public function blockDevice( string $fingerprint, ?string $reason = null, ?int $durationSeconds = null ): FirewallRuleObject { $this->requirePermission(self::PERMISSION_MANAGE); return $this->rules->blockDevice( FirewallRuleScope::system(), $fingerprint, $reason, $this->identity->identifier(), $durationSeconds ); } public function disableRule(string $ruleId): bool { $this->requirePermission(self::PERMISSION_MANAGE); return $this->rules->disable( FirewallRuleScope::system(), $ruleId, $this->identity->identifier() ); } public function removeRule(string $ruleId): bool { $this->requirePermission(self::PERMISSION_MANAGE); return $this->rules->remove( FirewallRuleScope::system(), $ruleId, $this->identity->identifier() ); } private function requirePermission(string $permission): void { if (!$this->identity->hasPermission($permission)) { throw new \RuntimeException("Missing required permission: {$permission}"); } } }