private static void SaveSettingsToSSO(string affiliateAppName, string inSettings, string userGroupName, string adminGroupName) { // Create affiliate app if it doesn't exist. if (!SSOSettingsManager.AppExists(affiliateAppName)) { SSOSettingsManager.CreateApp(affiliateAppName, userGroupName, adminGroupName); Console.WriteLine("Affiliate application '{0}' was created.", affiliateAppName); } else { Console.WriteLine("Affiliate application '{0}' already exists.", affiliateAppName); } SSOSettingsManager.WriteRawSettings(affiliateAppName, inSettings); Console.WriteLine("Settings file was associated with application '{0}' in SSO.", affiliateAppName); }
public static Hashtable Read(string affiliateApplication, bool enableRemoteAccess) { lock (_hashOfHashes) { // Clear all caches if the refresh interval has expired. ClearAllCachesIfRefreshIntervalExpired(); // Check to see if the application is in the table. Hashtable htToReturn = (Hashtable)_hashOfHashes[affiliateApplication]; if (htToReturn == null) { htToReturn = SSOSettingsManager.GetSettings(affiliateApplication, enableRemoteAccess); _hashOfHashes[affiliateApplication] = htToReturn; } return(htToReturn); } }
private static int Main(string[] args) { SSOSettingsFileImportCommandLine cl = new SSOSettingsFileImportCommandLine(); if (!cl.ParseAndContinue(args)) { return(-1); } if (cl.list) { try { Console.WriteLine(SSOSettingsManager.GetRawSettings(cl.affiliateAppName, false)); } catch (System.Exception ex) { Console.WriteLine("Unable to list application contents: " + ex.Message); return(1); } return(0); } if (cl.propToModify != null && cl.propValue != null) { try { SSOSettingsManager.WriteSetting(cl.affiliateAppName, cl.propToModify, cl.propValue); } catch (System.Exception ex) { Console.WriteLine("Unable to update property name/value: " + ex.Message); return(1); } return(0); } if (cl.deleteApp) { try { SSOSettingsManager.DeleteApp(cl.affiliateAppName); Console.WriteLine("Affiliate application '{0}' deleted.", cl.affiliateAppName); } catch (System.Exception ex) { Console.WriteLine("Unable to delete: " + ex.Message); } return(0); } string settingsXml = null; try { settings inSettings = null; // Make sure we can deserialize the file cleanly. XmlSerializer serializer = new XmlSerializer(typeof(settings)); using (FileStream stream = new FileStream(cl.settingsFile, FileMode.Open, FileAccess.Read)) { inSettings = (settings)serializer.Deserialize(stream); } StringBuilder sb = new StringBuilder(); StringWriter writer = new StringWriter(sb); serializer.Serialize(writer, inSettings); settingsXml = sb.ToString(); } catch (System.Exception ex) { Console.WriteLine("Error reading file:"); Console.WriteLine(ex.ToString()); return(-1); } try { SaveSettingsToSSO(cl.affiliateAppName, settingsXml, cl.userGroupName, cl.adminGroupName); } catch (System.Exception ex) { Console.WriteLine("Error persisting to SSO:"); Console.WriteLine(ex.ToString()); return(-1); } return(0); }
public static void Update(string affiliateApplication, Hashtable ht) { SSOSettingsManager.WriteSettings(affiliateApplication, ht); ClearCache(affiliateApplication); }