/// <summary>Validates the input parameters in the session context and applies the implicit parameter values.</summary> /// <remarks>The input parameters object is modified in-place.</remarks> public bool ValidateParameters(BplOperation operation, BplContextNode input) { if (operation == null || input == null || input.Class != operation.Input) return false; if (operation.ImplicitParameters != null) { foreach (var parameter in operation.ImplicitParameters.Where(p => p.ClientRole.Match(ClientRole))) { var property = parameter.Property; var sessionVariable = parameter.SessionVariable; if (sessionVariable == "DriverId" || sessionVariable == "UserId") { if (!_applyImplicitValue(input, property, UserId)) return false; } else if (sessionVariable == "VehicleId") { if (!_applyImplicitValue(input, property, VehicleId)) return false; } else if (sessionVariable == "DeviceId") { if (!_applyImplicitValue(input, property, DeviceId)) return false; } else if (sessionVariable == "BatteryId") { if (!_applyImplicitValue(input, property, BatteryId)) return false; } else if (sessionVariable == "VehicleSN") { if (!_applyImplicitValue(input, property, VehicleSN)) return false; } else if (sessionVariable == "BatterySN") { if (!_applyImplicitValue(input, property, BatterySN)) return false; } else if (sessionVariable == "Operator") { if (!_applyImplicitValue(input, property, Operator)) return false; } else { // unsupported implicit parameter return false; } } } return true; }
// Adds a service operation internal void Add(BplOperation operation) { _operationsList.Add(operation); }
private string TnsName(BplOperation operation) { return TnsName(operation.Name); }
/// <summary>Checks whether the given operation is permitted in the session context.</summary> public bool IsPermitted(BplOperation operation) { return operation != null && operation.Input != null && operation.Input.Consumer.Match(ClientRole); }