Example #1
0
        /// <summary>
        /// Gets the value.
        /// </summary>
        /// <param name="cUid">The c uid.</param>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public override object GetValue(string cUid, string key)
        {
            string uid = GetKey(cUid, key);

            UserLightPropertyCollection pc = Security.CurrentUser.Properties;

            string value = pc[uid];

            if (string.IsNullOrEmpty(value))
            {
                //dvs: load default setting for all users if available
                value = PortalConfig.GetValue(uid);

                if (string.IsNullOrEmpty(value))
                {
                    return(value);
                }
            }

            // Step 1. String to XmlSerializedItem
            XmlSerializedItem item = McXmlSerializer.GetObject <XmlSerializedItem>(value);

            // Step 2. XmlSerializedItem to object
            return(McXmlSerializer.GetObject(item.Type, item.Data));
        }
Example #2
0
        /// <summary>
        /// Updates and synchronizes DotNetNuke.install.config with Web.config
        /// </summary>
        /// <param name="installInfo"></param>
        private static void UpdateInstallConfig(Dictionary <string, string> installInfo)
        {
            _installConfig = new InstallConfig();
            // SuperUser Config
            _installConfig.SuperUser          = new SuperUserConfig();
            _installConfig.SuperUser.UserName = installInfo["username"];
            _installConfig.SuperUser.Password = installInfo["password"];
            _installConfig.SuperUser.Locale   = _culture;
            // Defaults
            _installConfig.SuperUser.Email     = "*****@*****.**";
            _installConfig.SuperUser.FirstName = "SuperUser";
            _installConfig.SuperUser.LastName  = "Account";

            // website culture
            _installConfig.InstallCulture = installInfo["language"];

            // Website Portal Config
            var portalConfig = new PortalConfig();

            portalConfig.PortalName       = installInfo["websiteName"];
            portalConfig.TemplateFileName = installInfo["template"];
            portalConfig.IsChild          = false;
            _installConfig.Portals        = new List <PortalConfig>();
            _installConfig.Portals.Add(portalConfig);

            InstallController.Instance.SetInstallConfig(_installConfig);
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            PortalConfig configPortal = (PortalConfig)HttpContext.Current.Items["PortalConfig"];

            try
            {
                string RutaTema = string.Concat("Temas/", Global.ObtenerTemaPortal(), "/Default.ascx");
                TemaHolder.Controls.Add(Page.LoadControl(RutaTema));
            }
            catch (System.IO.FileNotFoundException)
            {
                // Tema no encontrado, cargar tema por defecto
                TemaHolder.Controls.Add(Page.LoadControl("Temas/Defecto/Default.ascx"));
            }
        }
Example #4
0
        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            BaseDatabaseAccess.SetConnectionString(PortalConfig.ReadConnString());

            // Configure the db context and user manager to use a single instance per request
            app.CreatePerOwinContext(ApplicationDbContext.Create);
            app.CreatePerOwinContext <ApplicationUserManager>(ApplicationUserManager.Create);

            // Enable the application to use a cookie to store information for the signed in user
            // and to use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseCookieAuthentication(new CookieAuthenticationOptions());
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Configure the application for OAuth based flow
            PublicClientId = "self";
            OAuthOptions   = new OAuthAuthorizationServerOptions
            {
                TokenEndpointPath         = new PathString("/Token"),
                Provider                  = new ApplicationOAuthProvider(PublicClientId),
                AuthorizeEndpointPath     = new PathString("/api/Account/ExternalLogin"),
                AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
                // In production mode set AllowInsecureHttp = false
                AllowInsecureHttp = true
            };

            // Enable the application to use bearer tokens to authenticate users
            app.UseOAuthBearerTokens(OAuthOptions);

            // Uncomment the following lines to enable logging in with third party login providers
            //app.UseMicrosoftAccountAuthentication(
            //    clientId: "",
            //    clientSecret: "");

            //app.UseTwitterAuthentication(
            //    consumerKey: "",
            //    consumerSecret: "");

            //app.UseFacebookAuthentication(
            //    appId: "",
            //    appSecret: "");

            //app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
            //{
            //    ClientId = "",
            //    ClientSecret = ""
            //});
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            PortalConfig configPortal = (PortalConfig)HttpContext.Current.Items["PortalConfig"];

            int pagId;

            int paginaActual = configPortal.PagActiva.PagId;;

            if (configPortal.PagActiva.PagPadre == -1)
            {
                pagId = configPortal.PagActiva.PagId;
            }
            else
            {
                pagId = BuscarPadre(configPortal.PagActiva.PagId);
            }

            ArrayList PaginasAutorizadas = new ArrayList();

            Menu.ClientScriptPath = Global.ObtenerRuta(Request) + "/Controles/DUEMETRI_UI_WebControls_HWMenu/1_0_0_0";
            Menu.ImagesPath       = Global.ObtenerRuta(Request) + "/Controles/DUEMETRI_UI_WebControls_HWMenu/1_0_0_0";

            IDataReader Hijas = PaginasBD.ObtenerHijas(pagId);

            //int agregadas = 0;

            while (Hijas.Read())
            {
                string GruposAutorizados = Hijas["GruposAutorizados"].ToString();
                if (SeguridadPortal.EstaEnGrupos(GruposAutorizados))
                {
                    string       Nombre       = Hijas["PagNombre"].ToString();
                    MenuTreeNode elementoMenu = new MenuTreeNode(Nombre);
                    elementoMenu.Link      = Global.ObtenerRuta(Request) + "/Default.aspx?pagid=" + Hijas["PagId"].ToString();
                    elementoMenu.Width     = Menu.Width;
                    elementoMenu.Font.Name = "Tahoma";
                    elementoMenu.Font.Bold = false;
                    elementoMenu.Font.Size = 11;
                    elementoMenu           = CreaSubMenu(elementoMenu, (int)Hijas["PagId"]);
                    Menu.Childs.Add(elementoMenu);
                }
            }

            Hijas.Close();
        }
        int BuscarPadre(int pagId)
        {
            int Resultado = pagId;

            PortalConfig configPortal = (PortalConfig)HttpContext.Current.Items["PortalConfig"];

            for (int i = 0; i < configPortal.Paginas.Count; i++)
            {
                Pagina pag = (Pagina)configPortal.Paginas[i];

                if (pag.PagId == pagId)
                {
                    Resultado = pag.ObtenerPrimera();
                }
            }

            return(Resultado);
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            PortalConfig configPortal = (PortalConfig)HttpContext.Current.Items["PortalConfig"];

            int Login = 0;

            if (Request.Params["login"] != null)
            {
                Login = Int32.Parse(Request.Params["login"]);
            }

            int Editar = 0;

            if (Request.Params["editar"] != null)
            {
                Editar = Int32.Parse(Request.Params["editar"]);
            }

            if (Editar == 1)
            {
                CargarEdicion();
            }
            else
            {
                if (SeguridadPortal.EstaEnGrupos(configPortal.PagActiva.GruposAutorizados))
                {
                    if (Login == 1)
                    {
                        CargarLogin();
                    }

                    foreach (Modulo _moduloConfig in configPortal.PagActiva.Modulos)
                    {
                        CargarModulo(_moduloConfig);
                    }
                }
                else
                {
                    CargarAccesoDenegado();
                }
            }
        }
Example #8
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            PortalConfig configPortal = (PortalConfig)HttpContext.Current.Items["PortalConfig"];

            ControlModuloPortal moduloPortal = (ControlModuloPortal)this.Parent;

            if (Request.Params["pagid"] != null)
            {
                pagId = Int32.Parse(Request.Params["pagid"]);
            }

            TituloModulo.Text = moduloPortal.ConfiguracionModulo.ModuloTitulo;

            if (SeguridadPortal.EstaEnGrupos(moduloPortal.ConfiguracionModulo.GruposAutorizadosEdicion) && (TextoEditar != null))
            {
                Editar.Text        = TextoEditar;
                Editar.ToolTip     = TextoEditar;
                Editar.NavigateUrl = "~/Default.aspx?editar=1&mid=" + moduloPortal.ModuloId.ToString();
                Editar.Visible     = true;
            }
        }
Example #9
0
        void EnlazarDatos()
        {
            PortalConfig configPortal = (PortalConfig)HttpContext.Current.Items["PortalConfig"];

            vistaPaginas.Nodes.Clear();

            for (int i = 0; i < configPortal.Paginas.Count; i++)
            {
                Pagina pag = (Pagina)configPortal.Paginas[i];

                if ((pag.PagPadre == -1) && (!pag.Sistema))
                {
                    TreeNode tn = new TreeNode();

                    tn.Text     = pag.PagNombre;
                    tn.NodeData = pag.PagId.ToString();
                    tn.Expanded = true;
                    tn.ImageUrl = "Temas/Defecto/Imagenes/pagina.gif";
                    CargarHijas(pag.PagId, tn);
                    vistaPaginas.Nodes.Add(tn);
                }
            }
        }
        /// <summary>
        /// GetInstallConfig - Returns configuration stored in DotNetNuke.Install.Config
        /// </summary>
        /// <returns>ConnectionConfig object. Null if information is not present in the config file</returns>
        public InstallConfig GetInstallConfig()
        {
            var installConfig = new InstallConfig();

            //Load Template
            var installTemplate = new XmlDocument {
                XmlResolver = null
            };

            Upgrade.GetInstallTemplate(installTemplate);

            //Parse the root node
            XmlNode rootNode = installTemplate.SelectSingleNode("//dotnetnuke");

            if (rootNode != null)
            {
                installConfig.Version             = XmlUtils.GetNodeValue(rootNode.CreateNavigator(), "version");
                installConfig.SupportLocalization = XmlUtils.GetNodeValueBoolean(rootNode.CreateNavigator(), "supportLocalization");
                installConfig.InstallCulture      = XmlUtils.GetNodeValue(rootNode.CreateNavigator(), "installCulture") ?? Localization.Localization.SystemLocale;
            }

            //Parse the scripts node
            XmlNode scriptsNode = installTemplate.SelectSingleNode("//dotnetnuke/scripts");

            if (scriptsNode != null)
            {
                foreach (XmlNode scriptNode in scriptsNode)
                {
                    if (scriptNode != null)
                    {
                        installConfig.Scripts.Add(scriptNode.InnerText);
                    }
                }
            }

            //Parse the connection node
            XmlNode connectionNode = installTemplate.SelectSingleNode("//dotnetnuke/connection");

            if (connectionNode != null)
            {
                var connectionConfig = new ConnectionConfig();

                //Build connection string from the file
                connectionConfig.Server                  = XmlUtils.GetNodeValue(connectionNode.CreateNavigator(), "server");
                connectionConfig.Database                = XmlUtils.GetNodeValue(connectionNode.CreateNavigator(), "database");
                connectionConfig.File                    = XmlUtils.GetNodeValue(connectionNode.CreateNavigator(), "file");
                connectionConfig.Integrated              = XmlUtils.GetNodeValue(connectionNode.CreateNavigator(), "integrated").ToLowerInvariant() == "true";
                connectionConfig.User                    = XmlUtils.GetNodeValue(connectionNode.CreateNavigator(), "user");
                connectionConfig.Password                = XmlUtils.GetNodeValue(connectionNode.CreateNavigator(), "password");
                connectionConfig.RunAsDbowner            = XmlUtils.GetNodeValue(connectionNode.CreateNavigator(), "runasdbowner").ToLowerInvariant() == "true";
                connectionConfig.Qualifier               = XmlUtils.GetNodeValue(connectionNode.CreateNavigator(), "qualifier");
                connectionConfig.UpgradeConnectionString = XmlUtils.GetNodeValue(connectionNode.CreateNavigator(), "upgradeconnectionstring");

                installConfig.Connection = connectionConfig;
            }

            //Parse the superuser node
            XmlNode superUserNode = installTemplate.SelectSingleNode("//dotnetnuke/superuser");

            if (superUserNode != null)
            {
                var superUserConfig = new SuperUserConfig();

                superUserConfig.FirstName      = XmlUtils.GetNodeValue(superUserNode.CreateNavigator(), "firstname");
                superUserConfig.LastName       = XmlUtils.GetNodeValue(superUserNode.CreateNavigator(), "lastname");
                superUserConfig.UserName       = XmlUtils.GetNodeValue(superUserNode.CreateNavigator(), "username");
                superUserConfig.Password       = XmlUtils.GetNodeValue(superUserNode.CreateNavigator(), "password");
                superUserConfig.Email          = XmlUtils.GetNodeValue(superUserNode.CreateNavigator(), "email");
                superUserConfig.Locale         = XmlUtils.GetNodeValue(superUserNode.CreateNavigator(), "locale");
                superUserConfig.UpdatePassword = XmlUtils.GetNodeValue(superUserNode.CreateNavigator(), "updatepassword").ToLowerInvariant() == "true";

                installConfig.SuperUser = superUserConfig;
            }

            //Parse the license node
            XmlNode licenseNode = installTemplate.SelectSingleNode("//dotnetnuke/license");

            if (licenseNode != null)
            {
                var licenseConfig = new LicenseConfig();

                licenseConfig.AccountEmail  = XmlUtils.GetNodeValue(licenseNode.CreateNavigator(), "accountEmail");
                licenseConfig.InvoiceNumber = XmlUtils.GetNodeValue(licenseNode.CreateNavigator(), "invoiceNumber");
                licenseConfig.WebServer     = XmlUtils.GetNodeValue(licenseNode.CreateNavigator(), "webServer");
                licenseConfig.LicenseType   = XmlUtils.GetNodeValue(licenseNode.CreateNavigator(), "licenseType");

                if (!String.IsNullOrEmpty(XmlUtils.GetNodeValue(licenseNode.CreateNavigator(), "trial")))
                {
                    licenseConfig.TrialRequest = bool.Parse(XmlUtils.GetNodeValue(licenseNode.CreateNavigator(), "trial"));
                }

                installConfig.License = licenseConfig;
            }

            //Parse the settings node
            XmlNode settingsNode = installTemplate.SelectSingleNode("//dotnetnuke/settings");

            if (settingsNode != null)
            {
                foreach (XmlNode settingNode in settingsNode.ChildNodes)
                {
                    if (settingNode != null && !string.IsNullOrEmpty(settingNode.Name))
                    {
                        bool settingIsSecure = false;
                        if (settingNode.Attributes != null)
                        {
                            XmlAttribute secureAttrib = settingNode.Attributes["Secure"];
                            if ((secureAttrib != null))
                            {
                                if (secureAttrib.Value.ToLowerInvariant() == "true")
                                {
                                    settingIsSecure = true;
                                }
                            }
                        }
                        installConfig.Settings.Add(new HostSettingConfig {
                            Name = settingNode.Name, Value = settingNode.InnerText, IsSecure = settingIsSecure
                        });
                    }
                }
            }
            var folderMappingsNode = installTemplate.SelectSingleNode("//dotnetnuke/" + FolderMappingsConfigController.Instance.ConfigNode);

            installConfig.FolderMappingsSettings = (folderMappingsNode != null)? folderMappingsNode.InnerXml : String.Empty;

            //Parse the portals node
            XmlNodeList portalsNode = installTemplate.SelectNodes("//dotnetnuke/portals/portal");

            if (portalsNode != null)
            {
                foreach (XmlNode portalNode in portalsNode)
                {
                    if (portalNode != null)
                    {
                        var portalConfig = new PortalConfig();
                        portalConfig.PortalName = XmlUtils.GetNodeValue(portalNode.CreateNavigator(), "portalname");

                        XmlNode adminNode = portalNode.SelectSingleNode("administrator");
                        if (adminNode != null)
                        {
                            portalConfig.AdminFirstName = XmlUtils.GetNodeValue(adminNode.CreateNavigator(), "firstname");
                            portalConfig.AdminLastName  = XmlUtils.GetNodeValue(adminNode.CreateNavigator(), "lastname");
                            portalConfig.AdminUserName  = XmlUtils.GetNodeValue(adminNode.CreateNavigator(), "username");
                            portalConfig.AdminPassword  = XmlUtils.GetNodeValue(adminNode.CreateNavigator(), "password");
                            portalConfig.AdminEmail     = XmlUtils.GetNodeValue(adminNode.CreateNavigator(), "email");
                        }
                        portalConfig.Description      = XmlUtils.GetNodeValue(portalNode.CreateNavigator(), "description");
                        portalConfig.Keywords         = XmlUtils.GetNodeValue(portalNode.CreateNavigator(), "keywords");
                        portalConfig.TemplateFileName = XmlUtils.GetNodeValue(portalNode.CreateNavigator(), "templatefile");
                        portalConfig.IsChild          = XmlUtils.GetNodeValue(portalNode.CreateNavigator(), "ischild").ToLowerInvariant() == "true";
                        ;
                        portalConfig.HomeDirectory = XmlUtils.GetNodeValue(portalNode.CreateNavigator(), "homedirectory");

                        //Get the Portal Alias
                        XmlNodeList portalAliases = portalNode.SelectNodes("portalaliases/portalalias");
                        if (portalAliases != null)
                        {
                            foreach (XmlNode portalAliase in portalAliases)
                            {
                                if (!string.IsNullOrEmpty(portalAliase.InnerText))
                                {
                                    portalConfig.PortAliases.Add(portalAliase.InnerText);
                                }
                            }
                        }
                        installConfig.Portals.Add(portalConfig);
                    }
                }
            }

            return(installConfig);
        }
Example #11
0
        private void CreateSite(PortalConfig portal, InstallConfig installConfig)
        {
            var domain = "";

            if ((HttpContext.Current != null))
            {
                domain = Globals.GetDomainName(HttpContext.Current.Request, true).ToLowerInvariant().Replace("/install/launchautoinstall", "").Replace("/install", "").Replace("/runinstall", "");
            }

            var portalController = new PortalController();
            var serverPath       = Globals.ApplicationMapPath + "\\";

            //Get the Portal Alias
            var portalAlias = domain;

            if (portal.PortAliases.Count > 0)
            {
                portalAlias = portal.PortAliases[0];
            }

            //Verify that portal alias is not present
            if (PortalAliasController.GetPortalAliasLookup(portalAlias.ToLower()) != null)
            {
                string description = Localization.Localization.GetString("SkipCreatingSite", LocalInstallResourceFile);
                Details = string.Format(description, portalAlias);
                return;
            }

            //Create default email
            var email = portal.AdminEmail;

            if (string.IsNullOrEmpty(email))
            {
                email = "admin@" + domain.Replace("www.", "");
                //Remove any domain subfolder information ( if it exists )
                if (email.IndexOf("/") != -1)
                {
                    email = email.Substring(0, email.IndexOf("/"));
                }
            }

            //install LP if installing in a different language
            string culture = installConfig.InstallCulture;

            if (!culture.Equals("en-us", StringComparison.InvariantCultureIgnoreCase))
            {
                string installFolder = HttpContext.Current.Server.MapPath("~/Install/language");
                Upgrade.InstallPackage(installFolder + "\\installlanguage.resources", "Language", false);
            }

            var      template = Upgrade.FindBestTemplate(portal.TemplateFileName);
            UserInfo userInfo;

            if (!String.IsNullOrEmpty(portal.AdminUserName))
            {
                userInfo = Upgrade.CreateUserInfo(portal.AdminFirstName, portal.AdminLastName, portal.AdminUserName, portal.AdminPassword, email);
            }
            else
            {
                userInfo = Upgrade.CreateUserInfo(installConfig.SuperUser.FirstName, installConfig.SuperUser.LastName, installConfig.SuperUser.UserName, installConfig.SuperUser.Password, installConfig.SuperUser.Email);
            }

            var childPath = string.Empty;

            if (portal.IsChild)
            {
                childPath = portalAlias.Substring(portalAlias.LastIndexOf("/") + 1);
            }

            //Create Portal
            var portalId = portalController.CreatePortal(portal.PortalName,
                                                         userInfo,
                                                         portal.Description,
                                                         portal.Keywords,
                                                         template,
                                                         portal.HomeDirectory,
                                                         portalAlias,
                                                         serverPath,
                                                         serverPath + childPath,
                                                         portal.IsChild);

            if (portalId > -1)
            {
                foreach (var alias in portal.PortAliases)
                {
                    portalController.AddPortalAlias(portalId, alias);
                }
            }

            //remove en-US from portal if installing in a different language
            if (!culture.Equals("en-us", StringComparison.InvariantCultureIgnoreCase))
            {
                var locale = LocaleController.Instance.GetLocale("en-US");
                Localization.Localization.RemoveLanguageFromPortal(portalId, locale.LanguageId);
            }

            //Log user in to site
            var loginStatus = UserLoginStatus.LOGIN_FAILURE;

            UserController.UserLogin(portalId, userInfo.Username, installConfig.SuperUser.Password, "", "", "", ref loginStatus, false);

            InstallController.Instance.RemoveFromInstallConfig("//dotnetnuke/superuser/password");
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            PortalConfig configPortal = (PortalConfig)HttpContext.Current.Items["PortalConfig"];

            nombrePortal.Text = configPortal.Nombre;

            if (Request.IsAuthenticated == true)
            {
                string Usuario = UsuariosBD.ObtenerNombre(Context.User.Identity.Name);
                hypUsuario.Text        = Usuario;
                hypUsuario.NavigateUrl = Global.ObtenerRuta(Request) + "/Administracion/NombreUsuario.aspx?pagid=" + configPortal.PagActiva.PagId.ToString() + "&usuario=" + Context.User.Identity.Name;

                hypLogin.Text = "Salir";

                hypLogin.NavigateUrl = Global.ObtenerRuta(Request) + "/Administracion/Salir.aspx";
            }
            else
            {
                hypLogin.Text        = "Ingresar";
                hypLogin.NavigateUrl = Global.ObtenerRuta(Request) + "/Default.aspx?pagid=" + configPortal.PagActiva.PagId.ToString() + "&login=1";
                hypUsuario.Text      = hypUsuario.NavigateUrl = "";
            }

            if (MostrarPaginas)
            {
                int pagId;

                if (configPortal.PagActiva.PagPadre == -1)
                {
                    pagId = configPortal.PagActiva.PagId;
                }
                else
                {
                    pagId = BuscarPadre(configPortal.PagActiva.PagId);
                }

                // Build list of tabs to be shown to user
                ArrayList PaginasAutorizadas = new ArrayList();

                int agregadas = 0;

                for (int i = 0; i < configPortal.Paginas.Count; i++)
                {
                    Pagina pag = (Pagina)configPortal.Paginas[i];

                    if (SeguridadPortal.EstaEnGrupos(pag.GruposAutorizados) && (pag.PagPadre == -1))
                    {
                        PaginasAutorizadas.Add(pag);

                        if (pag.PagId == pagId)
                        {
                            Paginas.SelectedIndex = agregadas;
                        }

                        agregadas++;
                    }
                }

                Paginas.DataSource = PaginasAutorizadas;
                Paginas.DataBind();
            }
        }
Example #13
0
 public PortalOptionsModel(PortalConfig po)
     : base(po)
 {
 }