Tighten the ResellerCSR and PlatformCSR roles and give them the capabilities

to update chargeable items such as plan assignement and add ons

Fixed plan quota viewer that got broken with last commit
This commit is contained in:
robvde 2012-09-03 17:29:59 +04:00
parent 503dddcf4e
commit 02c59802db
14 changed files with 111 additions and 31 deletions

View file

@ -719,6 +719,15 @@ namespace WebsitePanel.EnterpriseServer
// check account
result.Result = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive
| DemandAccount.IsReseller);
if (result.Result < 0)
result.Result = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive
| DemandAccount.IsPlatformCSR);
if (result.Result < 0)
result.Result = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive
| DemandAccount.IsResellerCSR);
if (result.Result < 0) return result;
// load package
@ -979,6 +988,15 @@ namespace WebsitePanel.EnterpriseServer
// check account
result.Result = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive
| DemandAccount.IsReseller);
if (result.Result < 0)
result.Result = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive
| DemandAccount.IsPlatformCSR);
if (result.Result < 0)
result.Result = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive
| DemandAccount.IsResellerCSR);
if (result.Result < 0) return result;
int addonId = 0;
@ -1004,6 +1022,15 @@ namespace WebsitePanel.EnterpriseServer
// check account
result.Result = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive
| DemandAccount.IsReseller);
if (result.Result < 0)
result.Result = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive
| DemandAccount.IsPlatformCSR);
if (result.Result < 0)
result.Result = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive
| DemandAccount.IsResellerCSR);
if (result.Result < 0) return result;
result.ExceedingQuotas = DataProvider.UpdatePackageAddon(SecurityContext.User.UserId, addon.PackageAddonId,

View file

@ -37,4 +37,5 @@
<AdminContainer>Edit.ascx</AdminContainer>
<!-- SSL Settings -->
<UseSSL>false</UseSSL>
<HideDemoCheckbox>true</HideDemoCheckbox>
</SiteSettings>

View file

@ -197,7 +197,7 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="WebSites" title="WebSites" icon="location_48.png" />
<Module moduleDefinitionID="WebSites" title="WebSites" icon="location_48.png" readOnlyRoles="PlatformCSR,ResellerCSR"/>
</Content>
</Page>
@ -289,12 +289,12 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="SqlDatabases" title="Sql2000Databases" icon="mssql_48.png">
<Module moduleDefinitionID="SqlDatabases" title="Sql2000Databases" icon="mssql_48.png" readOnlyRoles="PlatformCSR,ResellerCSR">
<Settings>
<Add name="GroupName" value="MsSQL2000" />
</Settings>
</Module>
<Module moduleDefinitionID="SqlUsers" title="Sql2000Users" icon="db_user_48.png">
<Module moduleDefinitionID="SqlUsers" title="Sql2000Users" icon="db_user_48.png" readOnlyRoles="PlatformCSR,ResellerCSR">
<Settings>
<Add name="GroupName" value="MsSQL2000" />
</Settings>
@ -309,12 +309,12 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="SqlDatabases" title="Sql2005Databases" icon="mssql_48.png">
<Module moduleDefinitionID="SqlDatabases" title="Sql2005Databases" icon="mssql_48.png" readOnlyRoles="PlatformCSR,ResellerCSR">
<Settings>
<Add name="GroupName" value="MsSQL2005" />
</Settings>
</Module>
<Module moduleDefinitionID="SqlUsers" title="Sql2005Users" icon="db_user_48.png">
<Module moduleDefinitionID="SqlUsers" title="Sql2005Users" icon="db_user_48.png" readOnlyRoles="PlatformCSR,ResellerCSR">
<Settings>
<Add name="GroupName" value="MsSQL2005" />
</Settings>
@ -329,12 +329,12 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="SqlDatabases" title="Sql2008Databases" icon="mssql_48.png">
<Module moduleDefinitionID="SqlDatabases" title="Sql2008Databases" icon="mssql_48.png" readOnlyRoles="PlatformCSR,ResellerCSR">
<Settings>
<Add name="GroupName" value="MsSQL2008" />
</Settings>
</Module>
<Module moduleDefinitionID="SqlUsers" title="Sql2008Users" icon="db_user_48.png">
<Module moduleDefinitionID="SqlUsers" title="Sql2008Users" icon="db_user_48.png" readOnlyRoles="PlatformCSR,ResellerCSR">
<Settings>
<Add name="GroupName" value="MsSQL2008" />
</Settings>
@ -349,12 +349,12 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="SqlDatabases" title="Sql2012Databases" icon="mssql_48.png">
<Module moduleDefinitionID="SqlDatabases" title="Sql2012Databases" icon="mssql_48.png" readOnlyRoles="PlatformCSR,ResellerCSR">
<Settings>
<Add name="GroupName" value="MsSQL2012" />
</Settings>
</Module>
<Module moduleDefinitionID="SqlUsers" title="Sql2012Users" icon="db_user_48.png">
<Module moduleDefinitionID="SqlUsers" title="Sql2012Users" icon="db_user_48.png" readOnlyRoles="PlatformCSR,ResellerCSR">
<Settings>
<Add name="GroupName" value="MsSQL2012" />
</Settings>
@ -369,12 +369,12 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="SqlDatabases" title="MySql4Databases" icon="mysql_48.png">
<Module moduleDefinitionID="SqlDatabases" title="MySql4Databases" icon="mysql_48.png" readOnlyRoles="PlatformCSR,ResellerCSR">
<Settings>
<Add name="GroupName" value="MySQL4" />
</Settings>
</Module>
<Module moduleDefinitionID="SqlUsers" title="MySql4Users" icon="db_user_48.png">
<Module moduleDefinitionID="SqlUsers" title="MySql4Users" icon="db_user_48.png" readOnlyRoles="PlatformCSR,ResellerCSR">
<Settings>
<Add name="GroupName" value="MySQL4" />
</Settings>
@ -389,12 +389,12 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="SqlDatabases" title="MySql5Databases" icon="mysql_48.png">
<Module moduleDefinitionID="SqlDatabases" title="MySql5Databases" icon="mysql_48.png" readOnlyRoles="PlatformCSR,ResellerCSR">
<Settings>
<Add name="GroupName" value="MySQL5" />
</Settings>
</Module>
<Module moduleDefinitionID="SqlUsers" title="MySql5Users" icon="db_user_48.png">
<Module moduleDefinitionID="SqlUsers" title="MySql5Users" icon="db_user_48.png" readOnlyRoles="PlatformCSR,ResellerCSR">
<Settings>
<Add name="GroupName" value="MySQL5" />
</Settings>
@ -409,7 +409,7 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="SharedSSL" title="SharedSSL" icon="world_lock_48.png" />
<Module moduleDefinitionID="SharedSSL" title="SharedSSL" icon="world_lock_48.png" readOnlyRoles="PlatformCSR,ResellerCSR"/>
</Content>
</Page>
@ -420,7 +420,7 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="AdvancedStatistics" title="AdvancedStatistics" icon="stadistics_48.png" />
<Module moduleDefinitionID="AdvancedStatistics" title="AdvancedStatistics" icon="stadistics_48.png" readOnlyRoles="PlatformCSR,ResellerCSR"/>
</Content>
</Page>
@ -431,7 +431,7 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="ODBC" title="ODBC" icon="export_db_back_48.png" />
<Module moduleDefinitionID="ODBC" title="ODBC" icon="export_db_back_48.png" readOnlyRoles="PlatformCSR,ResellerCSR"/>
</Content>
</Page>
@ -442,7 +442,7 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="ScheduledTasks" title="ScheduledTasks" icon="calendar_month_2_clock_48.png" />
<Module moduleDefinitionID="ScheduledTasks" title="ScheduledTasks" icon="calendar_month_2_clock_48.png" readOnlyRoles="PlatformCSR,ResellerCSR"/>
</Content>
</Page>
@ -453,7 +453,7 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="FileManager" title="FileManager" icon="cabinet_48.png" />
<Module moduleDefinitionID="FileManager" title="FileManager" icon="cabinet_48.png" readOnlyRoles="PlatformCSR,ResellerCSR"/>
</Content>
</Page>
@ -464,7 +464,7 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="WebApplicationsGallery" title="WebApplicationsGallery" container="Browse.ascx" icon="dvd_disc_48.png" />
<Module moduleDefinitionID="WebApplicationsGallery" title="WebApplicationsGallery" container="Browse.ascx" icon="dvd_disc_48.png" readOnlyRoles="PlatformCSR,ResellerCSR"/>
</Content>
</Page>
@ -478,7 +478,7 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="SharePointSites" title="SharePointSites" icon="colors_48.png" />
<Module moduleDefinitionID="SharePointSites" title="SharePointSites" icon="colors_48.png" readOnlyRoles="PlatformCSR,ResellerCSR"/>
</Content>
</Page>
@ -489,8 +489,8 @@
</Module>
</Content>
<Content id="ContentPane">
<Module moduleDefinitionID="SharePointUsers" title="SharePointUsers" icon="user_48.png" />
<Module moduleDefinitionID="SharePointGroups" title="SharePointGroups" icon="group_48.png" />
<Module moduleDefinitionID="SharePointUsers" title="SharePointUsers" icon="user_48.png" readOnlyRoles="PlatformCSR,ResellerCSR"/>
<Module moduleDefinitionID="SharePointGroups" title="SharePointGroups" icon="group_48.png" readOnlyRoles="PlatformCSR,ResellerCSR"/>
</Content>
</Page>
@ -500,19 +500,19 @@
<Page name="SpaceExchangeServer" roles="Administrator,Reseller,PlatformCSR,ResellerCSR,PlatformHelpdesk,ResellerHelpdesk,User" hidden="True" skin="Exchange.ascx" adminskin="Exchange.ascx">
<Content id="ContentPane">
<Module moduleDefinitionID="ExchangeServer" title="ExchangeServer" icon="" container="Exchange.ascx" admincontainer="Exchange.ascx" readOnlyRoles="ResellerCSR"/>
<Module moduleDefinitionID="ExchangeServer" title="ExchangeServer" icon="" container="Exchange.ascx" admincontainer="Exchange.ascx" readOnlyRoles="PlatformCSR,ResellerCSR"/>
</Content>
</Page>
<Page name="SpaceVPS" roles="Administrator,Reseller,PlatformCSR,ResellerCSR,PlatformHelpdesk,ResellerHelpdesk,User" hidden="True" skin="VPS.ascx" adminskin="VPS.ascx">
<Content id="ContentPane">
<Module moduleDefinitionID="VPS" title="VirtualPrivateServers" icon="" container="VPS.ascx" admincontainer="VPS.ascx"/>
<Module moduleDefinitionID="VPS" title="VirtualPrivateServers" icon="" container="VPS.ascx" admincontainer="VPS.ascx" readOnlyRoles="PlatformCSR,ResellerCSR"/>
</Content>
</Page>
<Page name="SpaceVPSForPC" roles="Administrator,Reseller,PlatformCSR,ResellerCSR,PlatformHelpdesk,ResellerHelpdesk,User" hidden="True" skin="VPS.ascx" adminskin="VPS.ascx">
<Content id="ContentPane">
<Module moduleDefinitionID="VPSForPC" title="VirtualPrivateServersForPrivateCloud" icon="" container="VPSForPC.ascx" admincontainer="VPSForPC.ascx"/>
<Module moduleDefinitionID="VPSForPC" title="VirtualPrivateServersForPrivateCloud" icon="" container="VPSForPC.ascx" admincontainer="VPSForPC.ascx" readOnlyRoles="PlatformCSR,ResellerCSR"/>
</Content>
</Page>

View file

@ -975,6 +975,9 @@
<data name="Error.108" xml:space="preserve">
<value>You should have Reseller priviledges to perform this operation</value>
</data>
<data name="Error.112" xml:space="preserve">
<value>You have not enough priviledges to perform this operation</value>
</data>
<data name="Error.1201" xml:space="preserve">
<value>Web Site does not exist</value>
</data>

View file

@ -404,6 +404,21 @@ namespace WebsitePanel.Portal
return bResult;
}
public static bool GetHideDemoCheckbox()
{
bool bResult = false;
try
{
bResult = Convert.ToBoolean(PortalConfiguration.SiteSettings["HideDemoCheckbox"]);
}
catch (Exception)
{
}
return bResult;
}
private static int GetAuthenticationFormsTimeout()

View file

@ -51,10 +51,11 @@ namespace WebsitePanel.Portal.ExchangeServer
private void BindStats()
{
// set quotas
OrganizationStatistics stats =
ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID);
OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID);
OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID);
domainsQuota.QuotaUsedValue = stats.CreatedDomains;
domainsQuota.QuotaValue = stats.AllocatedDomains;
if (stats.AllocatedDomains != -1) domainsQuota.QuotaAvailable = tenantStats.AllocatedDomains - tenantStats.CreatedDomains;
}
public string GetDomainRecordsEditUrl(string domainId)

View file

@ -40,9 +40,27 @@ namespace WebsitePanel.Portal
{
BindSpace();
BindSpaceAddons();
BindRoles(PanelSecurity.EffectiveUserId);
}
}
private void BindRoles(int userId)
{
// load selected user
UserInfo user = UsersHelper.GetUser(userId);
if (user != null)
{
if ((user.Role == UserRole.User) |
(PanelSecurity.LoggedUser.Role == UserRole.ResellerCSR) |
(PanelSecurity.LoggedUser.Role == UserRole.ResellerHelpdesk) |
(PanelSecurity.LoggedUser.Role == UserRole.PlatformCSR) |
(PanelSecurity.LoggedUser.Role == UserRole.PlatformHelpdesk))
this.rbPackageQuotas.Enabled = this.rbPlanQuotas.Enabled = false;
}
}
private void BindSpace()
{
PackageInfo package = ES.Services.Packages.GetPackage(PanelSecurity.PackageId);

View file

@ -19,7 +19,8 @@
<uc1:QuotaViewer ID="quota" runat="server"
QuotaTypeId='<%# Eval("QuotaTypeId") %>'
QuotaUsedValue='<%# Eval("QuotaUsedValue") %>'
QuotaValue='<%# Eval("QuotaValue") %>' />
QuotaValue='<%# Eval("QuotaValue") %>'
QuotaAvailable='<%# Eval("QuotaAvailable") %>'/>
</div>
</div>
</ItemTemplate>

View file

@ -54,6 +54,9 @@ namespace WebsitePanel.Portal
try
{
dsQuotas = ES.Services.Packages.GetPackageQuotas(packageId);
dsQuotas.Tables[1].Columns.Add("QuotaAvailable", typeof(int));
foreach (DataRow r in dsQuotas.Tables[1].Rows) r["QuotaAvailable"] = -1;
dlGroups.DataSource = dsQuotas.Tables[0];
dlGroups.DataBind();
}

View file

@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3074
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

View file

@ -191,7 +191,8 @@ namespace WebsitePanel.Portal
{
if (user.Role == UserRole.Reseller || user.Role == UserRole.User)
role.Items.Remove("Administrator");
if (user.Role == UserRole.User)
if ((user.Role == UserRole.User) |(PanelSecurity.LoggedUser.Role == UserRole.ResellerCSR) |
(PanelSecurity.LoggedUser.Role == UserRole.ResellerHelpdesk))
role.Items.Remove("Reseller");
}
}

View file

@ -77,6 +77,7 @@ namespace WebsitePanel.Portal
quotaViewer.QuotaTypeId = quota.QuotaTypeId;
quotaViewer.QuotaUsedValue = quota.QuotaUsedValue;
quotaViewer.QuotaValue = quota.QuotaAllocatedValue;
quotaViewer.QuotaAvailable = -1;
//this.Visible = quota.QuotaAllocatedValue != 0;
}
else
@ -85,6 +86,7 @@ namespace WebsitePanel.Portal
quotaViewer.QuotaTypeId = 1; // bool
quotaViewer.QuotaUsedValue = 0;
quotaViewer.QuotaValue = 0;
quotaViewer.QuotaAvailable = -1;
}
}
catch

View file

@ -74,6 +74,10 @@ namespace WebsitePanel.Portal
if (!createResources)
return;
if ((PanelSecurity.LoggedUser.Role == UserRole.ResellerCSR) |
(PanelSecurity.LoggedUser.Role == UserRole.ResellerHelpdesk))
this.chkCreateResources.Enabled = this.chkIntegratedOUProvisioning.Enabled = false;
bool systemEnabled = false;
bool webEnabled = false;

View file

@ -62,6 +62,7 @@ namespace WebsitePanel.Portal
bool accountSummaryEmailEnabled = !String.IsNullOrEmpty(settings["EnableLetter"]) && Utils.ParseBool(settings["EnableLetter"], false);
this.chkAccountLetter.Enabled = accountSummaryEmailEnabled;
this.pnlDisabledSummaryLetterHint.Visible = !accountSummaryEmailEnabled;
if (PortalUtils.GetHideDemoCheckbox()) this.lblDemoAccount.Visible = this.chkDemo.Checked = this.chkDemo.Visible = false;
//reseller.UserId = PanelSecurity.SelectedUserId;
userPassword.SetUserPolicy(PanelSecurity.SelectedUserId, UserSettings.WEBSITEPANEL_POLICY, "PasswordPolicy");
@ -71,6 +72,10 @@ namespace WebsitePanel.Portal
{
if (user.Role == UserRole.User)
role.Items.Remove("Reseller");
if ((PanelSecurity.LoggedUser.Role == UserRole.ResellerCSR) |
(PanelSecurity.LoggedUser.Role == UserRole.ResellerHelpdesk))
role.Items.Remove("Reseller");
}
private void SaveUser()