From b47c96bad5a7a27a6cedfbd0628b0b10c502cce7 Mon Sep 17 00:00:00 2001 From: robvde Date: Mon, 3 Sep 2012 18:41:34 +0400 Subject: [PATCH] Fixed issue where peer account cannot create a mailbox OrganizatioHome adaptive for contacts, list, folder (if 0 dont show) Hosted Organization for consumers menu updated to show only essential items for peers Create Mailbox for consumers adjusted not to create room or equipment mbx Appearance of demo account check boxes optional by putting true in SiteSettings.config --- WebsitePanel/Database/install_db.sql | 3 -- WebsitePanel/Database/update_db.sql | 47 ++++++++++++++++ .../ExchangeServer/ExchangeCreateMailbox.ascx | 2 - .../ExchangeCreateMailbox.ascx.cs | 2 + .../ExchangeCreateMailbox.ascx.designer.cs | 9 ---- .../ExchangeServer/OrganizationHome.ascx | 6 +-- .../ExchangeServer/OrganizationHome.ascx.cs | 31 +++++++---- .../OrganizationHome.ascx.designer.cs | 27 ++++++++++ .../ExchangeServer/UserControls/Menu.ascx.cs | 53 ++++++++++++++----- .../WebsitePanel/PeersEditPeer.ascx.cs | 2 + .../UserAccountEditDetails.ascx.cs | 2 + 11 files changed, 144 insertions(+), 40 deletions(-) diff --git a/WebsitePanel/Database/install_db.sql b/WebsitePanel/Database/install_db.sql index c105cd31..51ea6af1 100644 --- a/WebsitePanel/Database/install_db.sql +++ b/WebsitePanel/Database/install_db.sql @@ -20957,9 +20957,6 @@ CREATE PROCEDURE [dbo].[GetPackages] ) AS -IF dbo.CheckActorUserRights(@ActorID, @UserID) = 0 -RAISERROR('You are not allowed to access this account', 16, 1) - SELECT P.PackageID, P.ParentPackageID, diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 030a2b12..445609d2 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -5184,3 +5184,50 @@ END DROP TABLE #TempBlackBerryUsers GO + + + + + + + + +ALTER PROCEDURE [dbo].[GetPackages] +( + @ActorID int, + @UserID int +) +AS + +SELECT + P.PackageID, + P.ParentPackageID, + P.PackageName, + P.StatusID, + P.PurchaseDate, + + -- server + ISNULL(P.ServerID, 0) AS ServerID, + ISNULL(S.ServerName, 'None') AS ServerName, + ISNULL(S.Comments, '') AS ServerComments, + ISNULL(S.VirtualServer, 1) AS VirtualServer, + + -- hosting plan + P.PlanID, + HP.PlanName, + + -- user + P.UserID, + U.Username, + U.FirstName, + U.LastName, + U.RoleID, + U.Email +FROM Packages AS P +INNER JOIN Users AS U ON P.UserID = U.UserID +INNER JOIN Servers AS S ON P.ServerID = S.ServerID +INNER JOIN HostingPlans AS HP ON P.PlanID = HP.PlanID +WHERE + P.UserID = @UserID +RETURN +GO \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx index 696e3be4..1e659428 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx @@ -121,8 +121,6 @@ User mailbox - Room mailbox - Equipment mailbox diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs index 541d6021..1b76f43d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs @@ -86,6 +86,8 @@ namespace WebsitePanel.Portal.ExchangeServer if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) { locSubscriberNumber.Visible = txtSubscriberNumber.Visible = valRequireSubscriberNumber.Enabled = false; + rbMailboxType.Items.Add(new System.Web.UI.WebControls.ListItem(GetLocalizedString("RoomMailbox"),"5")); + rbMailboxType.Items.Add(new System.Web.UI.WebControls.ListItem(GetLocalizedString("EquipmentMailbox"),"6")); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.designer.cs index 8569624f..9558a3a5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.designer.cs @@ -344,14 +344,5 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1; - - /// - /// FormComments control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize FormComments; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx index 9d8c9601..39e932a2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx @@ -86,7 +86,7 @@ - + @@ -94,7 +94,7 @@ - + @@ -102,7 +102,7 @@ - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs index 87eb7bdc..a173dbbe 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs @@ -67,21 +67,34 @@ namespace WebsitePanel.Portal.ExchangeServer mailboxesStats.QuotaValue = exchangeOrgStats.AllocatedMailboxes; if (exchangeOrgStats.AllocatedMailboxes != -1) mailboxesStats.QuotaAvailable = exchangeTenantStats.AllocatedMailboxes - exchangeTenantStats.CreatedMailboxes; - contactsStats.QuotaUsedValue = exchangeOrgStats.CreatedContacts; - contactsStats.QuotaValue = exchangeOrgStats.AllocatedContacts; - if (exchangeOrgStats.AllocatedContacts != -1) contactsStats.QuotaAvailable = exchangeTenantStats.AllocatedContacts - exchangeTenantStats.CreatedContacts; - listsStats.QuotaUsedValue = exchangeOrgStats.CreatedDistributionLists; - listsStats.QuotaValue = exchangeOrgStats.AllocatedDistributionLists; - if (exchangeOrgStats.AllocatedDistributionLists != -1) listsStats.QuotaAvailable = exchangeTenantStats.AllocatedDistributionLists - exchangeTenantStats.CreatedDistributionLists; + if (exchangeTenantStats.AllocatedContacts == 0) this.rowContacts.Style.Add("display", "none"); + else + { + contactsStats.QuotaUsedValue = exchangeOrgStats.CreatedContacts; + contactsStats.QuotaValue = exchangeOrgStats.AllocatedContacts; + if (exchangeOrgStats.AllocatedContacts != -1) contactsStats.QuotaAvailable = exchangeTenantStats.AllocatedContacts - exchangeTenantStats.CreatedContacts; + } + + if (exchangeTenantStats.AllocatedDistributionLists == 0) this.rowLists.Style.Add("display", "none"); + else + { + listsStats.QuotaUsedValue = exchangeOrgStats.CreatedDistributionLists; + listsStats.QuotaValue = exchangeOrgStats.AllocatedDistributionLists; + if (exchangeOrgStats.AllocatedDistributionLists != -1) listsStats.QuotaAvailable = exchangeTenantStats.AllocatedDistributionLists - exchangeTenantStats.CreatedDistributionLists; + } exchangeStorageStats.QuotaUsedValue = exchangeOrgStats.UsedDiskSpace; exchangeStorageStats.QuotaValue = exchangeOrgStats.AllocatedDiskSpace; if (exchangeOrgStats.AllocatedDiskSpace != -1) exchangeStorageStats.QuotaAvailable = exchangeTenantStats.AllocatedDiskSpace - exchangeTenantStats.UsedDiskSpace; - foldersStats.QuotaUsedValue = exchangeOrgStats.CreatedPublicFolders; - foldersStats.QuotaValue = exchangeOrgStats.AllocatedPublicFolders; - if (exchangeOrgStats.AllocatedPublicFolders != -1) foldersStats.QuotaAvailable = exchangeTenantStats.AllocatedPublicFolders - exchangeTenantStats.CreatedPublicFolders; + if (exchangeTenantStats.AllocatedPublicFolders == 0) this.rowFolders.Style.Add("display", "none"); + else + { + foldersStats.QuotaUsedValue = exchangeOrgStats.CreatedPublicFolders; + foldersStats.QuotaValue = exchangeOrgStats.AllocatedPublicFolders; + if (exchangeOrgStats.AllocatedPublicFolders != -1) foldersStats.QuotaAvailable = exchangeTenantStats.AllocatedPublicFolders - exchangeTenantStats.CreatedPublicFolders; + } } private void BindOrgStats() diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs index 0082016b..478c23bf 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs @@ -183,6 +183,15 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::WebsitePanel.Portal.QuotaViewer mailboxesStats; + /// + /// rowContacts control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow rowContacts; + /// /// lnkContacts control. /// @@ -201,6 +210,15 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::WebsitePanel.Portal.QuotaViewer contactsStats; + /// + /// rowLists control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow rowLists; + /// /// lnkLists control. /// @@ -219,6 +237,15 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::WebsitePanel.Portal.QuotaViewer listsStats; + /// + /// rowFolders control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow rowFolders; + /// /// lnkFolders control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs index dcb79f7e..aceb2231 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs @@ -111,7 +111,16 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls private void PrepareExchangeMenu(PackageContext cntx, List groups, string imagePath) { - + bool hideItems = false; + + UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId); + + if (user != null) + { + if ((user.Role == UserRole.User) & (CheckQouta(Quotas.EXCHANGE2007_ISCONSUMER, cntx))) + hideItems = true; + } + MenuGroup exchangeGroup = new MenuGroup(GetLocalizedString("Text.ExchangeGroup"), imagePath + "exchange24.png"); if (CheckQouta(Quotas.EXCHANGE2007_MAILBOXES, cntx)) @@ -126,16 +135,19 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls if (CheckQouta(Quotas.EXCHANGE2007_PUBLICFOLDERS, cntx)) exchangeGroup.MenuItems.Add(CreateMenuItem("PublicFolders", "public_folders")); - if (CheckQouta(Quotas.EXCHANGE2007_ACTIVESYNCALLOWED, cntx)) - exchangeGroup.MenuItems.Add(CreateMenuItem("ActiveSyncPolicy", "activesync_policy")); + if (!hideItems) + if (CheckQouta(Quotas.EXCHANGE2007_ACTIVESYNCALLOWED, cntx)) + exchangeGroup.MenuItems.Add(CreateMenuItem("ActiveSyncPolicy", "activesync_policy")); if (CheckQouta(Quotas.EXCHANGE2007_MAILBOXES, cntx)) exchangeGroup.MenuItems.Add(CreateMenuItem("MailboxPlans", "mailboxplans")); - if (CheckQouta(Quotas.ORGANIZATION_DOMAINS, cntx)) - exchangeGroup.MenuItems.Add(CreateMenuItem("DomainNames", "domains")); + if (!hideItems) + if (CheckQouta(Quotas.ORGANIZATION_DOMAINS, cntx)) + exchangeGroup.MenuItems.Add(CreateMenuItem("DomainNames", "domains")); - exchangeGroup.MenuItems.Add(CreateMenuItem("StorageUsage", "storage_usage")); + if (!hideItems) + exchangeGroup.MenuItems.Add(CreateMenuItem("StorageUsage", "storage_usage")); if (exchangeGroup.MenuItems.Count > 0) groups.Add(exchangeGroup); @@ -144,14 +156,27 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls private void PrepareOrganizationMenu(PackageContext cntx, List groups, string imagePath) { - MenuGroup organizationGroup = new MenuGroup(GetLocalizedString("Text.OrganizationGroup"), imagePath + "company24.png"); - //if (CheckQouta(Quotas.ORGANIZATION_DOMAINS, cntx)) - // organizationGroup.MenuItems.Add(CreateMenuItem("DomainNames", "domains")); - if (CheckQouta(Quotas.ORGANIZATION_USERS, cntx)) - organizationGroup.MenuItems.Add(CreateMenuItem("Users", "users")); - - if (organizationGroup.MenuItems.Count >0) - groups.Add(organizationGroup); + bool hideItems = false; + + UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId); + + if (user != null) + { + if ((user.Role == UserRole.User) & (CheckQouta(Quotas.EXCHANGE2007_ISCONSUMER, cntx))) + hideItems = true; + } + + if (!hideItems) + { + MenuGroup organizationGroup = new MenuGroup(GetLocalizedString("Text.OrganizationGroup"), imagePath + "company24.png"); + //if (CheckQouta(Quotas.ORGANIZATION_DOMAINS, cntx)) + // organizationGroup.MenuItems.Add(CreateMenuItem("DomainNames", "domains")); + if (CheckQouta(Quotas.ORGANIZATION_USERS, cntx)) + organizationGroup.MenuItems.Add(CreateMenuItem("Users", "users")); + + if (organizationGroup.MenuItems.Count > 0) + groups.Add(organizationGroup); + } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PeersEditPeer.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PeersEditPeer.ascx.cs index 0f052cb3..ba5ab8ca 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PeersEditPeer.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PeersEditPeer.ascx.cs @@ -49,6 +49,8 @@ namespace WebsitePanel.Portal if (!IsPostBack) { BindUser(); + + if (PortalUtils.GetHideDemoCheckbox()) chkDemo.Visible = lblDemoAccount.Visible= false; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountEditDetails.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountEditDetails.ascx.cs index 43906bb2..f669dfe6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountEditDetails.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountEditDetails.ascx.cs @@ -40,6 +40,8 @@ namespace WebsitePanel.Portal if (!IsPostBack) { BindUser(); + + if (PortalUtils.GetHideDemoCheckbox()) rowDemo.Visible = false; } }