/// <summary> /// Check the settings file and restrict the operation if needed. /// </summary> /// <param name="eventArgs"></param> private void RestrictOperation(WebServiceCommandEventArgs eventArgs, string eventName) { RestrictSettings settings = RestrictSettings.Load(); if (settings.RestrictedOperations.Contains(eventName)) { eventArgs.AddRestriction(new ExtensionRestriction("Unknown", "Test restriction")); } }
/// <summary> /// Check the settings file and restrict the operation if needed. /// </summary> /// <param name="eventArgs"></param> private void RestrictOperation(WebServiceCommandEventArgs eventArgs, string eventName) { RestrictSettings settings = RestrictSettings.Load(); if (settings.RestrictedOperations.Contains(eventName)) { eventArgs.AddRestriction(new ExtensionRestriction("Parallel Approval - Change State", "The listed states are required to finally release: " + mParallelStates[0] + ", " + mParallelStates[1] + ", " + mParallelStates[2])); } }
public static RestrictSettings Load() { RestrictSettings retVal = null; try { using (System.IO.StreamReader reader = new System.IO.StreamReader(GetSettingsPath())) { XmlSerializer serializer = new XmlSerializer(typeof(RestrictSettings)); retVal = (RestrictSettings)serializer.Deserialize(reader); } } catch { } // if we run into an error, just return a blank settings if (retVal == null) { retVal = new RestrictSettings(); } return(retVal); }