예제 #1
0
        public object SaveSettings(string defaultProductID)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                var defaultPageSettingsObj = new StudioDefaultPageSettings
                {
                    DefaultProductID = new Guid(defaultProductID)
                };
                var resultStatus = SettingsManager.Instance.SaveSettings(defaultPageSettingsObj, TenantProvider.CurrentTenantID);

                AdminLog.PostAction("Settings: default product ID \"{0}\"", defaultProductID);

                return(new
                {
                    Status = 1,
                    Message = Resources.Resource.SuccessfullySaveSettingsMessage
                });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message.HtmlEncode() });
            }
        }
예제 #2
0
        public object SaveSettings(string defaultProductID)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                var defaultPageSettingsObj = new StudioDefaultPageSettings
                {
                    DefaultProductID = new Guid(defaultProductID)
                };
                SettingsManager.Instance.SaveSettings(defaultPageSettingsObj, TenantProvider.CurrentTenantID);

                MessageService.Send(HttpContext.Current.Request, MessageAction.DefaultStartPageSettingsUpdated);

                return(new
                {
                    Status = 1,
                    Message = Resources.Resource.SuccessfullySaveSettingsMessage
                });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message.HtmlEncode() });
            }
        }
예제 #3
0
        public string SaveDefaultPageSettings(string defaultProductID)
        {
            SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

            var defaultPageSettingsObj = new StudioDefaultPageSettings
            {
                DefaultProductID = new Guid(defaultProductID)
            };

            SettingsManager.Instance.SaveSettings(defaultPageSettingsObj, TenantProvider.CurrentTenantID);

            MessageService.Send(HttpContext.Current.Request, MessageAction.DefaultStartPageSettingsUpdated);

            return(Resources.Resource.SuccessfullySaveSettingsMessage);
        }
예제 #4
0
        public IEnumerable <SecurityWrapper> SetAccessToWebItems(IEnumerable <ItemKeyValuePair <String, Boolean> > items)
        {
            SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

            var itemList = new ItemDictionary <String, Boolean>();

            foreach (ItemKeyValuePair <String, Boolean> item in items)
            {
                if (!itemList.ContainsKey(item.Key))
                {
                    itemList.Add(item.Key, item.Value);
                }
            }

            var defaultPageSettings = StudioDefaultPageSettings.Load();

            foreach (var item in itemList)
            {
                Guid[] subjects  = null;
                var    productId = new Guid(item.Key);

                if (item.Value)
                {
                    var webItem = WebItemManager.Instance[productId] as IProduct;
                    if (webItem != null)
                    {
                        var productInfo    = WebItemSecurity.GetSecurityInfo(item.Key);
                        var selectedGroups = productInfo.Groups.Select(group => group.ID).ToList();
                        var selectedUsers  = productInfo.Users.Select(user => user.ID).ToList();
                        selectedUsers.AddRange(selectedGroups);
                        if (selectedUsers.Count > 0)
                        {
                            subjects = selectedUsers.ToArray();
                        }
                    }
                }
                else if (productId == defaultPageSettings.DefaultProductID)
                {
                    (defaultPageSettings.GetDefault() as StudioDefaultPageSettings).Save();
                }

                WebItemSecurity.SetSecurity(item.Key, item.Value, subjects);
            }

            MessageService.Send(Request, MessageAction.ProductsListUpdated);

            return(GetWebItemSecurityInfo(itemList.Keys.ToList()));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.RegisterBodyScripts("~/UserControls/Management/DefaultPageSettings/js/defaultpage.js");

            DefaultPages = new List <DefaultStartPageWrapper>();

            var defaultPageSettings = StudioDefaultPageSettings.Load();

            DefaultProductID = defaultPageSettings.DefaultProductID;

            var products = WebItemManager.Instance.GetItemsAll <IProduct>().Where(p => p.Visible);

            foreach (var p in products)
            {
                var productInfo = WebItemSecurity.GetSecurityInfo(p.ID.ToString());
                if (productInfo.Enabled)
                {
                    DefaultPages.Add(new DefaultStartPageWrapper
                    {
                        ProductID   = p.ID,
                        DisplayName = p.Name,
                        ProductName = p.GetSysName(),
                        IsSelected  = DefaultProductID.Equals(p.ID)
                    });
                }
            }

            DefaultPages.Add(new DefaultStartPageWrapper
            {
                ProductID   = defaultPageSettings.FeedModuleID,
                DisplayName = Resources.UserControlsCommonResource.FeedTitle,
                ProductName = "feed",
                IsSelected  = DefaultProductID.Equals(defaultPageSettings.FeedModuleID)
            });

            DefaultPages.Add(new DefaultStartPageWrapper
            {
                ProductID   = Guid.Empty,
                DisplayName = Resources.Resource.DefaultPageSettingsChoiseOfProducts,
                ProductName = string.Empty,
                IsSelected  = DefaultProductID.Equals(Guid.Empty)
            });

            HelpLink = CommonLinkUtility.GetHelpLink();
        }
예제 #6
0
        private static void SetDefaultModule(string module)
        {
            if (string.IsNullOrEmpty(module))
            {
                return;
            }
            try
            {
                LogManager.GetLogger("ASC.Web").Debug("SetDefaultModule " + module);
                var defaultPageSettingsObj = new StudioDefaultPageSettings
                {
                    DefaultProductID = new Guid(module),
                };
                SettingsManager.Instance.SaveSettings(defaultPageSettingsObj, TenantProvider.CurrentTenantID);

                MessageService.Send(HttpContext.Current.Request, MessageAction.DefaultStartPageSettingsUpdated);
            }
            catch (Exception ex)
            {
                LogManager.GetLogger("ASC.Web").Error("SetDefaultModule", ex);
            }
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.RegisterBodyScripts("~/UserControls/Management/DefaultPageSettings/js/defaultpage.js");

            DefaultPages = new List <DefaultStartPageWrapper>();

            var defaultPageSettings = StudioDefaultPageSettings.Load();

            DefaultProductID = defaultPageSettings.DefaultProductID;

            var products = WebItemManager.Instance.GetItemsAll <IProduct>().Where(p => p.Visible);

            foreach (var p in products)
            {
                var productInfo = WebItemSecurity.GetSecurityInfo(p.ID.ToString());
                if (productInfo.Enabled)
                {
                    DefaultPages.Add(new DefaultStartPageWrapper
                    {
                        ProductID   = p.ID,
                        DisplayName = p.Name,
                        ProductName = p.GetSysName(),
                        IsSelected  = DefaultProductID.Equals(p.ID)
                    });
                }
            }

            var addons        = WebItemManager.Instance.GetItemsAll <IAddon>().Where(a => a.Visible && a.ID != WebItemManager.VoipModuleID);
            var isEnabledTalk = ConfigurationManagerExtension.AppSettings["web.talk"] ?? "false";

            foreach (var a in addons)
            {
                var productInfo = WebItemSecurity.GetSecurityInfo(a.ID.ToString());
                if (a.GetSysName() == "talk" && isEnabledTalk == "false")
                {
                    continue;
                }
                if (productInfo.Enabled)
                {
                    DefaultPages.Add(new DefaultStartPageWrapper
                    {
                        ProductID   = a.ID,
                        DisplayName = a.Name,
                        ProductName = a.GetSysName(),
                        IsSelected  = DefaultProductID.Equals(a.ID)
                    });
                }
            }

            DefaultPages.Add(new DefaultStartPageWrapper
            {
                ProductID   = defaultPageSettings.FeedModuleID,
                DisplayName = UserControlsCommonResource.FeedTitle,
                ProductName = "feed",
                IsSelected  = DefaultProductID.Equals(defaultPageSettings.FeedModuleID)
            });

            DefaultPages.Add(new DefaultStartPageWrapper
            {
                ProductID   = Guid.Empty,
                DisplayName = Resource.DefaultPageSettingsChoiseOfProducts,
                ProductName = string.Empty,
                IsSelected  = DefaultProductID.Equals(Guid.Empty)
            });

            HelpLink = CommonLinkUtility.GetHelpLink();
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CurrentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

            Page.RegisterStyle("~/skins/page_default.less");

            var defaultPageSettings = StudioDefaultPageSettings.Load();

            if (defaultPageSettings != null && defaultPageSettings.DefaultProductID != Guid.Empty)
            {
                if (defaultPageSettings.DefaultProductID == defaultPageSettings.FeedModuleID && !CurrentUser.IsOutsider())
                {
                    Response.Redirect("feed.aspx", true);
                }

                var products = WebItemManager.Instance.GetItemsAll <IProduct>();
                foreach (var p in products)
                {
                    if (p.ID.Equals(defaultPageSettings.DefaultProductID))
                    {
                        var productInfo = WebItemSecurity.GetSecurityInfo(p.ID.ToString());
                        if (productInfo.Enabled && WebItemSecurity.IsAvailableForUser(p.ID.ToString(), CurrentUser.ID))
                        {
                            var url = p.StartURL;
                            if (Request.DesktopApp())
                            {
                                url += "?desktop=true";
                                if (!string.IsNullOrEmpty(Request["first"]))
                                {
                                    url += "&first=true";
                                }
                            }
                            Response.Redirect(url, true);
                        }
                    }
                }
            }

            Master.DisabledSidePanel = true;

            Title = Resource.MainPageTitle;
            defaultListProducts = WebItemManager.Instance.GetItems(Web.Core.WebZones.WebZoneType.StartProductList);
            _showDocs           = (Product)defaultListProducts.Find(r => r.ID == WebItemManager.DocumentsProductID);
            if (_showDocs != null)
            {
                defaultListProducts.RemoveAll(r => r.ID == _showDocs.ProductID);
            }

            var mailProduct = WebItemManager.Instance[WebItemManager.MailProductID];

            if (mailProduct != null && !mailProduct.IsDisabled())
            {
                defaultListProducts.Add(mailProduct);
            }

            var calendarProduct = WebItemManager.Instance[WebItemManager.CalendarProductID];

            if (calendarProduct != null && !calendarProduct.IsDisabled())
            {
                defaultListProducts.Add(calendarProduct);
            }

            var talkProduct = WebItemManager.Instance[WebItemManager.TalkProductID];

            if (talkProduct != null && !talkProduct.IsDisabled())
            {
                defaultListProducts.Add(talkProduct);
            }

            var priority = GetStartProductsPriority();

            defaultListProducts = defaultListProducts
                                  .Where(p => priority.Keys.Contains(p.ID))
                                  .OrderBy(p => priority[p.ID])
                                  .ToList();

            CustomNavigationItems = CustomNavigationSettings.Load().Items.Where(x => x.ShowOnHomePage);

            ProductsCount = defaultListProducts.Count() + CustomNavigationItems.Count() + (TenantExtra.EnableControlPanel ? 1 : 0);
        }
예제 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CurrentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

            Page.RegisterStyle("~/skins/page_default.less");

            var defaultPageSettings = StudioDefaultPageSettings.Load();

            if (defaultPageSettings != null && defaultPageSettings.DefaultProductID != Guid.Empty)
            {
                if (defaultPageSettings.DefaultProductID == defaultPageSettings.FeedModuleID && !CurrentUser.IsOutsider())
                {
                    Response.Redirect("Feed.aspx", true);
                }

                var webItem = WebItemManager.Instance[defaultPageSettings.DefaultProductID];
                if (webItem != null && webItem.Visible)
                {
                    var securityInfo = WebItemSecurity.GetSecurityInfo(defaultPageSettings.DefaultProductID.ToString());
                    if (securityInfo.Enabled && WebItemSecurity.IsAvailableForMe(defaultPageSettings.DefaultProductID))
                    {
                        var url = webItem.StartURL;
                        if (Request.DesktopApp())
                        {
                            url += "?desktop=true";
                            if (!string.IsNullOrEmpty(Request["first"]))
                            {
                                url += "&first=true";
                            }
                        }
                        Response.Redirect(url, true);
                    }
                }
            }

            Master.DisabledSidePanel = true;

            Title = Resource.MainPageTitle;
            defaultListProducts = WebItemManager.Instance.GetItems(Web.Core.WebZones.WebZoneType.StartProductList);
            _showDocs           = (Product)defaultListProducts.Find(r => r.ID == WebItemManager.DocumentsProductID);
            if (_showDocs != null)
            {
                defaultListProducts.RemoveAll(r => r.ID == _showDocs.ProductID);
            }

            var mailProduct = WebItemManager.Instance[WebItemManager.MailProductID];

            if (mailProduct != null && !mailProduct.IsDisabled())
            {
                defaultListProducts.Add(mailProduct);
            }

            var calendarProduct = WebItemManager.Instance[WebItemManager.CalendarProductID];

            if (calendarProduct != null && !calendarProduct.IsDisabled())
            {
                defaultListProducts.Add(calendarProduct);
            }

            var talkProduct = WebItemManager.Instance[WebItemManager.TalkProductID];

            if (talkProduct != null && !talkProduct.IsDisabled())
            {
                defaultListProducts.Add(talkProduct);
            }

            var priority = GetStartProductsPriority();

            defaultListProducts = defaultListProducts
                                  .Where(p => priority.Keys.Contains(p.ID))
                                  .OrderBy(p => priority[p.ID])
                                  .ToList();

            CustomNavigationItems = CustomNavigationSettings.Load().Items.Where(x => x.ShowOnHomePage);

            ProductsCount = defaultListProducts.Count() + CustomNavigationItems.Count() + (TenantExtra.EnableControlPanel ? 1 : 0);

            ResetCacheKey = ConfigurationManagerExtension.AppSettings["web.client.cache.resetkey"] ?? "";

            if (CurrentUser.IsOwner() && TenantExtra.Saas && !CoreContext.Configuration.CustomMode && !TenantExtra.GetTenantQuota().Free)
            {
                var collaboratorPopupSettings = CollaboratorSettings.LoadForCurrentUser();
                if (collaboratorPopupSettings.FirstVisit)
                {
                    WelcomePanelHolder.Controls.Add(LoadControl(WelcomeDashboard.Location));
                }
            }
        }