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); }
/// <summary> /// Query the database for any connections that we have stored /// </summary> /// <returns></returns> private List <IWCCertificate> BuildConnections() { List <IWCCertificate> connections = new List <IWCCertificate>(); //Ask the database for the connectors IGenericsConnector genericsConnector = DataManager.DataManager.RequestPlugin <IGenericsConnector>(); if (genericsConnector != null) { connections = genericsConnector.GetGenerics <IWCCertificate>(UUID.Zero, "InterWorldConnections", new IWCCertificate()); } return(connections); }
/// <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); } }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector>(); var vars = new Dictionary <string, object>(); vars.Add("News", translator.GetTranslatedString("News")); vars.Add("NewsDateText", translator.GetTranslatedString("NewsDateText")); vars.Add("NewsTitleText", translator.GetTranslatedString("NewsTitleText")); vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText")); vars.Add("FirstText", translator.GetTranslatedString("FirstText")); vars.Add("BackText", translator.GetTranslatedString("BackText")); vars.Add("NextText", translator.GetTranslatedString("NextText")); vars.Add("LastText", translator.GetTranslatedString("LastText")); uint amountPerQuery = 10; int maxPages = 0; int start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query["Start"].ToString()) : 0; if (connector != null) { uint count = (uint)connector.GetGenericCount(UUID.Zero, "WebGridNews"); maxPages = (int)(count / amountPerQuery) - 1; if (start == -1) { start = (maxPages < 0 ? 0 : maxPages); } var newsItems = connector.GetGenerics <GridNewsItem> (UUID.Zero, "WebGridNews"); if (newsItems.Count == 0) { newsItems.Add(GridNewsItem.NoNewsItem); } vars.Add("NewsList", newsItems.ConvertAll <Dictionary <string, object> >(item => item.ToDictionary())); } vars.Add("CurrentPage", start); vars.Add("NextOne", start + 1 > maxPages ? start : start + 1); vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1); return(vars); }
protected override List <string> GetURIs(bool urlOverrides, OSDMap map, string url, UUID userID) { List <string> returnValue = new List <string>(); if (!map.Keys.Contains("regionID")) { return(returnValue); } UUID regionid = (UUID)Util.OSDToObject(map["regionID"], typeof(UUID)); List <RegionRegistrationURLs> urls = m_genericsConnector.GetGenerics <RegionRegistrationURLs>(regionid, "RegionRegistrationUrls"); foreach (RegionRegistrationURLs regionRegistrationUrLse in urls) { returnValue.Add(regionRegistrationUrLse.URLS["regionURI"].AsString()); } return(returnValue); }
private void HandleShowUsers(string[] cmd) { IGenericsConnector generics = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); List <UserData> users = generics.GetGenerics <UserData>(UUID.Zero, "ForeignUsers"); if (users.Count == 0) { MainConsole.Instance.Output("No users not found"); return; } MainConsole.Instance.Output("UUID User Name"); MainConsole.Instance.Output("-----------------------------------------------------------------------------"); foreach (UserData kvp in users) { MainConsole.Instance.Output(String.Format("{0} {1} {2}", kvp.Id, kvp.FirstName, kvp.LastName)); } return; }