public function deleteRule(EventInterface $event)
{
$acl = $event->getAccessControl();
if (!$acl instanceof MutableAdapterInterface) {
throw new ResourceException('Access control adapter is immutable', 405);
}
$request = $event->getRequest();
$publicKey = $request->getRoute()->get('publickey');
$accessRuleId = $request->getRoute()->get('accessRuleId');
$keyExists = $acl->publicKeyExists($publicKey);
if (!$keyExists) {
throw new RuntimeException('Public key not found', 404);
}
$accessRule = $acl->getAccessRule($publicKey, $accessRuleId);
if (!$accessRule) {
throw new RuntimeException('Access rule not found', 404);
}
$acl->deleteAccessRule($publicKey, $accessRuleId);
}