public SmartAPIException(ServerLogin login, string message) : base(message) { if (login != null) { Server = login.Name; } }
public SmartAPIException(ServerLogin login) { if (login != null) { Server = login.Name; } }
static void Main(string[] args) { var url = args[0]; var user = args[1]; var password = args[2]; var authData = new PasswordAuthentication(user, password); var login = new ServerLogin() { Address = new Uri(url), AuthData = authData }; using (var session = SessionBuilder.CreateOrReplaceOldestSession(login)) { var project = session.ServerManager.Projects["nav_demo"]; var search = project.Pages.CreateSearch(); search.PageType = PageType.Unlinked; var unlinkedPages = search.Execute(); IEnumerable <IPage> processedPages = new List <IPage>(); while (unlinkedPages.Any()) { foreach (var curPage in unlinkedPages) { Console.WriteLine("Deleting " + curPage); //curPage.Delete(); } processedPages = processedPages.Union(unlinkedPages); unlinkedPages = search.Execute().Where(page => !processedPages.Contains(page)); } Console.WriteLine("Done"); } }
protected override void PostDeserialize() { if (ServerAddress.IsNullOrTimmedEmpty()) { throw new InvalidOperationException("Please add a non empty server address for attribute 'serverAddress'."); } if (ServerNation.IsNullOrTimmedEmpty()) { throw new InvalidOperationException("Please add a non empty server nation for attribute 'serverNation'."); } if (ServerLogin.IsNullOrTimmedEmpty()) { throw new InvalidOperationException("Please add a non empty server login for attribute 'serverLogin'."); } if (ServerLoginPassword.IsNullOrTimmedEmpty()) { throw new InvalidOperationException("Please add a non empty server login password for attribute 'serverLoginPassword'."); } if (SuperAdminPassword.IsNullOrTimmedEmpty()) { throw new InvalidOperationException("Please add non empty super admin password for attribute 'superAdminPassword'."); } }
public void OpenRegister() { Login.SetActive(false); ServerLogin.SetActive(false); Register.SetActive(true); MainObject.SetActive(false); }
static void Main(string[] args) { // RedDot Login with (user/password) var authData = new PasswordAuthentication("user", "password"); var login = new ServerLogin() { Address = new Uri("http://localhost/cms"), AuthData = authData }; // Session is the entry point to interact with the RedDot server. // Creating the session object automatically creates a connection. // Dispose() closes the connection in a a clean way (this is done // automatically at the end of the using block). using (var session = SessionBuilder.CreateOrReplaceOldestSession(login)) { // Select a project based on the name var project = session.ServerManager.Projects.GetByName("MyProjekt"); // Find all pages based on the Content Class "MyContentClass" var pageSearch = project.Pages.CreateSearch(); pageSearch.ContentClass = project.ContentClasses.GetByName("MyContentClass"); var pages = pageSearch.Execute(); // Attach suffix ".php" to all filenames of the pages found foreach (var curPage in pages) { curPage.Filename = curPage.Filename + ".php"; // Commit changes to the server curPage.Commit(); } } }
public void Update(ServerLogin login) { var previous = _context.ServerLogins.Find(login.ServerLoginId); if (previous == null) { throw new NotFoundException("ServerLogin not found."); } if (string.IsNullOrWhiteSpace(login.UserName)) { throw new ValidationException("Missing UserName"); } if (string.IsNullOrWhiteSpace(login.PasswordHash)) { throw new ValidationException("Missing Password"); } if (!login.UserName.Equals(previous.UserName, StringComparison.InvariantCultureIgnoreCase) && GetByUserName(login.UserName, previous.DepartmentId, previous.ServerId) != null) { throw new ValidationException("User Name already exists."); } var entry = _context.Entry(previous); entry.Entity.UserName = login.UserName; entry.Entity.PasswordHash = login.PasswordHash; _context.SaveChanges(); _context.Entry(previous).State = EntityState.Detached; }
public ServerLogin Create(ServerLogin login) { if (login == null) throw new ArgumentNullException(nameof(login)); if (login.DepartmentId < 1) throw new ValidationException("Missing DepartmentId"); if (login.ServerId < 1) throw new ValidationException("Missing ServerId"); if(string.IsNullOrWhiteSpace(login.UserName)) throw new ValidationException("Missing UserName"); if (string.IsNullOrWhiteSpace(login.PasswordHash)) throw new ValidationException("Missing Password"); var result = new ServerLogin { ServerId = login.ServerId, DepartmentId = login.DepartmentId, UserName = login.UserName, PasswordHash = login.PasswordHash }; _context.ServerLogins.Add(result); _context.SaveChanges(); return result; }
public SmartAPIException(ServerLogin login, SerializationInfo info, StreamingContext context) : base(info, context) { if (login != null) { Server = login.Name; } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ServerLogin serverlogin = ConnectionHelpers.ServerLoginFromPowerPathRegistry(); Application.Run(new PPLoginForm(serverlogin)); }
public void Return() { Login.SetActive(false); ServerLogin.SetActive(false); Register.SetActive(false); Main.Instance.Web.WelcomeScreen.SetActive(false); Main.Instance.Web.ServerMessagesText.SetText(""); MainObject.SetActive(true); }
public BrokenContentClassFolderSharingException(ServerLogin login, IContentClassFolder folder, Guid sharedFromProjectGuid, Guid sharedFromFolderGuid) : base( login, string.Format( "Cannot load project/folder information on broken content class folder {0}. Missing project/folder: {1}/{2}", folder, sharedFromProjectGuid, sharedFromFolderGuid)) { _sharedFromProjectGuid = sharedFromProjectGuid; _sharedFromFolderGuid = sharedFromFolderGuid; }
public override void Validate(ServerLogin login, Version actualVersion, string method) { if (actualVersion >= Version) { string versionNameString = string.IsNullOrEmpty(VersionName) ? "" : " (" + VersionName + ")"; throw new InvalidServerVersionException(login, string.Format( "Invalid server version. {0} only works on servers with version less than {1}{3}, but the current server version is {2}", method, Version, actualVersion, versionNameString)); } }
static void Main(string[] args) { var authData = new PasswordAuthentication("admin", "123456"); var url = "http://localhost/cms"; var login = new ServerLogin(url, authData); using (var session = SessionBuilder.CreateOrReplaceOldestSession(login)) { //this is the currently active project in the session var selectedProject = session.SelectedProject; var serverManager = session.ServerManager; //these are all projects, the active user is assigned to var currentUsersProjects = serverManager.Projects.ForCurrentUser; //these are all projects for the user xy, you need to be server manager to do this var user = serverManager.Users["some username"]; var projectsOfUserXy = serverManager.Projects.ForUser(user.Guid); //these are all projects on the server, you need to be server manager to access projects you are not assigned to var allProjects = serverManager.Projects; //you can access a single project by name //var myProject = serverManager.Projects.ForCurrentUser["myproject"]; //this is the short for //var myProjectToo = serverManager.Projects.ForCurrentUser.GetByName("myproject"); //if you do not know whether a specific project exists, you can use IProject unknownProject; if (serverManager.Projects.ForCurrentUser.TryGetByName("nav_demo", out unknownProject)) { Console.WriteLine($"Found project with guid: {unknownProject.Guid}"); } else { Console.WriteLine("No project with name myproject assigned to user"); } //you can also get a project by guid var projectGuid = new Guid("..."); var projectByGuid = serverManager.Projects.ForCurrentUser.GetByGuid(projectGuid); // a TryGetByGuid method is available, too //print all project names and guids Console.WriteLine("Projects:"); foreach (var curProject in serverManager.Projects) { Console.WriteLine(curProject); } } }
/// <summary> /// Create an session object for an already existing session on the server, e.g. when opening a plugin from within a running session. /// </summary> public Session(ServerLogin login, Guid loginGuid, string sessionKey, Guid projectGuid) : this() { ServerLogin = login; _loginGuidStr = loginGuid.ToRQLString(); _sessionKeyStr = sessionKey; InitConnection(); XmlElement sessionInfo = GetUserSessionInfoElement(); SelectedProjectGuid = sessionInfo.GetGuid("projectguid"); SelectProject(projectGuid); }
void Awake() { #if UNITY_EDITOR if (DEBBUGER) { PlayerPrefs.DeleteAll(); } #endif loadingMask.SetActive(false); Instance = this; DontDestroyOnLoad(this.gameObject); serverLogin = GetComponent <ServerLogin> (); Events.SceneLoaded += SceneLoaded; Events.LoadScene += LoadScene; assetsBundleLoader = GetComponent <AssetsBundleLoader>(); // lo hace assetsBundle: serverLogin.Init(); }
public ServerLogin Create(ServerLogin login) { if (login == null) { throw new ArgumentNullException(nameof(login)); } if (login.DepartmentId < 1) { throw new ValidationException("Missing DepartmentId"); } if (login.ServerId < 1) { throw new ValidationException("Missing ServerId"); } if (string.IsNullOrWhiteSpace(login.UserName)) { throw new ValidationException("Missing UserName"); } if (string.IsNullOrWhiteSpace(login.PasswordHash)) { throw new ValidationException("Missing Password"); } var result = new ServerLogin { ServerId = login.ServerId, DepartmentId = login.DepartmentId, UserName = login.UserName, PasswordHash = login.PasswordHash }; _context.ServerLogins.Add(result); _context.SaveChanges(); return(result); }
protected void Page_Load(object sender, EventArgs e) { var authData = new PasswordAuthentication("", ""); var url = ""; var login = new ServerLogin(url, authData); using (var session = SessionBuilder.CreateOrReplaceOldestSession(login)) { var selectedProject = session.SelectedProject; var serverManager = session.ServerManager; var languageVariant = selectedProject.LanguageVariants.Current; var pageGuid = new Guid(""); var elementGuid = new Guid(""); var getElement = (ITextHtml)erminas.SmartAPI.CMS.Project.Pages.Elements.PageElementFactory.Instance.CreateElement(selectedProject, elementGuid, languageVariant); getElement.Value = "<p>my new text</p>"; getElement.Commit(); } }
// This constructor is needed for serialization. protected FileDataException(ServerLogin login, SerializationInfo info, StreamingContext context) : base(login, info, context) { // Add implementation. }
internal FileDataException(ServerLogin login, string message, Exception inner) : base(login, message, inner) { // Add implementation. }
internal FileDataException(ServerLogin login) : base(login) { // Add implementation. }
protected void Page_Load(object sender, EventArgs e) { foreach (string name in Request.QueryString) { try { dicSession.Add(name, Request.QueryString[name]); } catch { try { dicSession[name] = Request.QueryString[name]; } catch {} } } foreach (string name in Request.Form) { try { dicSession.Add(name, Request.Form[name]); } catch { try { dicSession[name] = Request.Form[name]; } catch { } } } showValues(dicSession); if (Request.QueryString.Count > 0) { Session["LoginGuid"] = Request["LoginGuid"]; Session["SessionKey"] = Request["SessionKey"]; Session["ProjectGuid"] = Request["ProjectGuid"]; } var url = "http://localhost/cms"; var login = new ServerLogin(url, null); Guid loginGuid = new Guid(Session["LoginGuid"].ToString()); Guid projectGuid = new Guid(Session["ProjectGuid"].ToString()); String sessionKey = Session["SessionKey"].ToString(); var sessionBuilder = new SessionBuilder(login, loginGuid, sessionKey, projectGuid); //session var session = sessionBuilder.CreateSession(); //serverManger var serverManager = session.ServerManager; selectedProject = serverManager.Projects.GetByGuid(projectGuid); //var selectedProject = session.ServerManager.Projects["tfl.gov.uk"]; //var selectedProject = session.SelectedProject; TextBox1.Text = "Project: " + selectedProject.Name; var projectVariants = selectedProject.ProjectVariants; var languageVariants = selectedProject.LanguageVariants; var allPages = selectedProject.Pages.OfCurrentLanguage; //does not work. must find alternetive if (!IsPostBack) { foreach (var prjVariant in projectVariants) { //populate variant in a drop down list ListItem tmpPrjVariant = new ListItem(prjVariant.Name, prjVariant.Name); CheckBoxPrjVariant.Items.Add(tmpPrjVariant); } foreach (var langVariant in languageVariants) { //populate variant in a drop down list ListItem tmpLangVariant = new ListItem(langVariant.Name, langVariant.Name); CheckBoxLangVariant.Items.Add(tmpLangVariant); } TextBox2.Text = "pages to publish: " + allPages.Count().ToString(); } /**/ if (IsPostBack) { disableBtn.Start(SubmitButton); //enableBtn.Start(SubmitButton); //Button1.Visible = false; oConsole.Text = string.Empty; //var allContentClass = session.; //var pageSearch = selectedProject.Pages.CreateSearch(); //pageSearch.Category = selectedProject.Pages.; //pageSearch.ContentClass = selectedProject.ContentClasses.GetByName("New content class"); /* * var allPages = pageSearch.Execute(); */ //startFullPublish.Start(obj); //SubmitButton.Enabled = true; /* * if(Methods.DebugMode > 0) * { * Debug1.Text = Methods.SessionVariables(dicSession) + Methods.viewDebug; * Debug1.Visible = true; * } */ //oConsoleCount.Start(oConsole); ThreadStart fullPublish = new ThreadStart(fullPublishCall); Thread startFullPublish = new Thread(fullPublish); //startFullPublish.Start(); var allPagess = selectedProject.Pages.OfCurrentLanguage; //does not work. must find alternetive foreach (var currPage in allPagess) { oConsole.Text += "publishing Page ID: " + currPage.Id.ToString() + "\n"; IPagePublishJob prop = currPage.CreatePublishJob(); prop.IsPublishingAllFollowingPages = false; prop.IsPublishingRelatedPages = false; prop.LanguageVariants = languageVariants; currPage.CreatePublishJob(); currPage.Commit(); } }
internal PageDeletionException(ServerLogin login, string message) : base(login, message) { Error = PageDeletionError.Unknown; }
public Session(ServerLogin login, Func <IEnumerable <RunningSessionInfo>, RunningSessionInfo> sessionReplacementSelector) : this() { ServerLogin = login; Login(sessionReplacementSelector); }
internal InvalidServerVersionException(ServerLogin server, string message) : base(server, message) { }
public void Update(ServerLogin login) { var previous = _context.ServerLogins.Find(login.ServerLoginId); if (previous == null) throw new NotFoundException("ServerLogin not found."); if (string.IsNullOrWhiteSpace(login.UserName)) throw new ValidationException("Missing UserName"); if (string.IsNullOrWhiteSpace(login.PasswordHash)) throw new ValidationException("Missing Password"); if (!login.UserName.Equals(previous.UserName, StringComparison.InvariantCultureIgnoreCase) && GetByUserName(login.UserName, previous.DepartmentId, previous.ServerId) != null) { throw new ValidationException("User Name already exists."); } var entry = _context.Entry(previous); entry.Entity.UserName = login.UserName; entry.Entity.PasswordHash = login.PasswordHash; _context.SaveChanges(); _context.Entry(previous).State = EntityState.Detached; }
public abstract void Validate(ServerLogin login, Version actualVersion, string method);