allows method

  1. @override
bool allows(
  1. dynamic operation
)
override

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;

  // 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;
}