checkDelete method
Check delete permission for a file path.
Implementation
PermissionDecision checkDelete(String path) {
final normalized = _normalizePath(path);
if (isProtectedPath(normalized)) {
return PermissionDecision(
level: PermissionLevel.deny,
reason:
'Path "$normalized" is a protected system path. '
'Delete operations are blocked.',
);
}
if (!isInSandbox(normalized)) {
return PermissionDecision(
level: PermissionLevel.deny,
reason: 'Path "$normalized" is outside the sandbox.',
);
}
final request = PermissionRequest(
scope: PermissionScope.file,
action: 'delete',
resource: normalized,
detail: 'Delete file: $normalized',
riskLevel: RiskLevel.high,
);
return _ruleSet.evaluateWithCache(request, _cache);
}