public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator) { var vars = new Dictionary <string, object>(); IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); if (httpRequest.Query.Contains("delete")) { string newsID = httpRequest.Query["delete"].ToString(); connector.RemoveGeneric(UUID.Zero, "WebGridNews", newsID); vars["Success"] = "Successfully deleted the news item"; } else { vars["Success"] = ""; } var newsItems = connector.GetGenerics <GridNewsItem>(UUID.Zero, "WebGridNews"); vars.Add("News", newsItems.ConvertAll <Dictionary <string, object> >(item => item.ToDictionary())); vars.Add("NewsManager", translator.GetTranslatedString("NewsManager")); vars.Add("EditNewsItem", translator.GetTranslatedString("EditNewsItem")); vars.Add("AddNewsItem", translator.GetTranslatedString("AddNewsItem")); vars.Add("DeleteNewsItem", translator.GetTranslatedString("DeleteNewsItem")); vars.Add("NewsTitleText", translator.GetTranslatedString("NewsTitleText")); vars.Add("NewsDateText", translator.GetTranslatedString("NewsDateText")); vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText")); vars.Add("DeleteNewsText", translator.GetTranslatedString("DeleteNewsText")); return(vars); }
public static void ResetToDefaults(WebInterface webinterface) { InitializeWebUIDefaults(webinterface); GetGridConfigSettings(webinterface); IGenericsConnector generics = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector> (); //Remove all pages generics.RemoveGeneric(UUID.Zero, "WebUISettings"); generics.RemoveGeneric(UUID.Zero, "GridSettings"); generics.RemoveGeneric(UUID.Zero, "WebSettingsVersion"); generics.AddGeneric(UUID.Zero, "WebUISettings", "Settings", _settingsWebUI.ToOSD()); generics.AddGeneric(UUID.Zero, "GridSettings", "Settings", _settingsGrid.ToOSD()); generics.AddGeneric(UUID.Zero, "WebSettingsVersion", "", new OSDWrapper { Info = CurrentVersion }.ToOSD()); }
private void RemoveConnection(IWCCertificate c) { if (Connections.Contains(c)) { Connections.Remove(c); IGenericsConnector genericsConnector = DataManager.DataManager.RequestPlugin <IGenericsConnector>(); if (genericsConnector != null) { genericsConnector.RemoveGeneric(UUID.Zero, "InterWorldConnections", c.Connection.RecieverURL); } } }
public static void ResetToDefaults() { InitializeDefaults(); IGenericsConnector generics = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector> (); //Remove all pages generics.RemoveGeneric(UUID.Zero, Schema); generics.AddGeneric(UUID.Zero, Schema, "Root", _rootPage.ToOSD()); generics.AddGeneric(UUID.Zero, Schema + "Version", "", new OSDWrapper { Info = CurrentVersion }.ToOSD()); }
public static void ResetToDefaults() { InitializeDefaults(); IGenericsConnector generics = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); //Remove all pages generics.RemoveGeneric(UUID.Zero, Schema); generics.AddGeneric(UUID.Zero, Schema, "Settings", _settings.ToOSD()); generics.AddGeneric(UUID.Zero, Schema + "Version", "", new OSDWrapper { Info = CurrentVersion }.ToOSD()); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object>(); IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector>(); GridNewsItem news; if (requestParameters.ContainsKey("Submit")) { string title = requestParameters["NewsTitle"].ToString(); string text = requestParameters["NewsText"].ToString(); string id = requestParameters["NewsID"].ToString(); news = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", id); if (news != null) { connector.RemoveGeneric(UUID.Zero, "WebGridNews", id); GridNewsItem item = new GridNewsItem { Text = text, Time = news.Time, Title = title, ID = int.Parse(id) }; connector.AddGeneric(UUID.Zero, "WebGridNews", id, item.ToOSD()); response = "<h3>News item editted successfully, redirecting to main page</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"index.html?page=news_manager\";}, 0);" + "</script>"; } return(null); } news = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString()); if (news != null) { vars.Add("NewsTitle", news.Title); vars.Add("NewsText", news.Text); vars.Add("NewsID", news.ID.ToString()); vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle")); vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText")); vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText")); vars.Add("Submit", translator.GetTranslatedString("Submit")); } return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator) { var vars = new Dictionary <string, object>(); IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); GridNewsItem news; if (requestParameters.ContainsKey("Submit")) { string title = requestParameters["NewsTitle"].ToString(); string text = requestParameters["NewsText"].ToString(); string id = requestParameters["NewsID"].ToString(); news = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", id); connector.RemoveGeneric(UUID.Zero, "WebGridNews", id); GridNewsItem item = new GridNewsItem { Text = text, Time = news.Time, Title = title, ID = int.Parse(id) }; connector.AddGeneric(UUID.Zero, "WebGridNews", id, item.ToOSD()); vars["ErrorMessage"] = "News item edit successfully"; webInterface.Redirect(httpResponse, "index.html?page=news_manager", filename); return(vars); } else { vars["ErrorMessage"] = ""; } news = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString()); vars.Add("NewsTitle", news.Title); vars.Add("NewsText", news.Text); vars.Add("NewsID", news.ID.ToString()); vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle")); vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText")); vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText")); vars.Add("Submit", translator.GetTranslatedString("Submit")); return(vars); }
/// <summary> /// Demotes an API User. /// </summary> /// <param name="scene">Scene.</param> /// <param name="cmd">Cmd.</param> void DemoteAPIUser(IScene scene, string [] cmd) { var userName = MainConsole.Instance.Prompt("Name of user <First> <Last>"); var userAcct = m_registry.RequestModuleInterface <IUserAccountService> ().GetUserAccount(null, userName); if (!userAcct.Valid) { MainConsole.Instance.Error("[API]: User does not exist!"); return; } var apiKeys = generics.GetGenerics <APIAuthItem> ((UUID)Constants.GovernorUUID, "APIKey"); if (apiKeys == null) { MainConsole.Instance.Warn("No API keys are currently active."); return; } var apiKey = ""; foreach (var apiItem in apiKeys) { if (apiItem.UserID == userAcct.PrincipalID) { apiKey = apiItem.APIKey; generics.RemoveGeneric(UUID.Zero, "APIKey", apiKey); // need something specific here to remove individual keys MainConsole.Instance.Info("[API]: Removed API key for " + userAcct.Name); break; } } if (apiKey == "") { MainConsole.Instance.Warn("[API]: Unable to locate a key for " + userAcct.Name); } }