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

@ -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()