protected void PasswordValidator_ServerValidate(object source, ServerValidateEventArgs args) { // Attempt to log in with supplied credentials try { var cluster = new Registry.Cluster(RegistryContext); cluster.Guid = new Guid(ClusterList.SelectedValue); cluster.Load(); cluster.LoadDomains(false); var domain = cluster.Domains[Registry.Constants.SharedDomainName]; var uu = new UserFactory(RegistryContext); user = uu.LoginUser(domain, Username.Text, Password.Text); RegistryContext.UserGuid = user.Guid; RegistryContext.UserName = user.Name; args.IsValid = true; } catch (EntityNotFoundException) { args.IsValid = false; } }
protected override void OnUserLoggedIn() { base.OnUserLoggedIn(); if (Cluster == null) { cluster = RegistryUser.Cluster; Session[Constants.SessionClusterGuid] = cluster.Guid; Session[Constants.SessionClusterName] = cluster.Name; } }
protected void RefreshServerVersionList() { Registry.Cluster cluster = RegistryContext.Cluster; cluster.LoadMachineRoles(false); ServerVersion.Items.Add(new ListItem("(select server version)", Guid.Empty.ToString())); foreach (MachineRole mr in cluster.MachineRoles.Values) { mr.LoadServerVersions(false); foreach (ServerVersion sv in mr.ServerVersions.Values) { ServerVersion.Items.Add(new ListItem(String.Format("{0}\\{1}", mr.Name, sv.Name), sv.Guid.ToString())); } } }