allows method
Checks if this permission allows the given operation.
Implementation
@override
bool allows(dynamic operation) {
if (operation is! Map<String, dynamic>) return false;
final opType = operation['type'];
final opCommand = operation['command'];
final opArgs = operation['args'];
if (opType != 'process') return false;
// DFIN3: a scope-free question ("is ANY process execution granted?") —
// the `dart:io` import gate asks it — waives the command and argument
// checks, as `pathAgnostic` does for a filesystem grant.
if (operation['commandAgnostic'] == true) return true;
// Check command restrictions
if (_command != null && opCommand != _command) {
return false;
}
// Check argument restrictions
if (_allowedArgs != null && opArgs != null) {
final args = opArgs as List<String>;
if (args.length != _allowedArgs.length) return false;
for (int i = 0; i < args.length; i++) {
if (args[i] != _allowedArgs[i]) return false;
}
}
return true;
}