More granularity to the available roles:

Available roles now in the platform: Administrator, Reseller, User, PlatformCSR,
PlatformHelpdesk, ResellerCSR, ResellerHelpdesk.

The platform CSR and Helpdesk are peer accounts on platform root level.

The names can be used within the  websitepanel_pages.config on Page and Module
level. On module level the roles can be specified on the viewRoles attribute and
readOnlyRoles attribute. When specifying the later all controls will be disabled
within the Modile, the viewRoles just show the page or not. When nothing
specified the page is just shown
This commit is contained in:
robvde 2012-07-11 18:18:13 +04:00
parent da0966657b
commit 37af5eceac
21 changed files with 423 additions and 127 deletions

View file

@ -326,6 +326,9 @@ namespace WebsitePanel.Portal
// localize grid viewes
LocalizeGridViews(this);
//if (PanelSecurity.LoggedUser != null)
//if (PanelSecurity.LoggedUser.Role == UserRole.CSR) DisableControls = false;
// call base handler
base.OnLoad(e);
}
@ -335,6 +338,43 @@ namespace WebsitePanel.Portal
// localize all controls
LocalizeModuleControls(this);
string role = string.Empty;
if (PanelSecurity.LoggedUser != null)
{
switch (PanelSecurity.LoggedUser.Role)
{
case UserRole.Administrator:
role = "Administrator";
break;
case UserRole.Reseller:
role = "Reseller";
break;
case UserRole.User:
role = "User";
break;
case UserRole.PlatformCSR:
role = "PlatformCSR";
break;
case UserRole.PlatformHelpdesk:
role = "PlatformHelpdesk";
break;
case UserRole.ResellerCSR:
role = "ResellerCSR";
break;
case UserRole.ResellerHelpdesk:
role = "ResellerHelpdesk";
break;
}
}
if (Module != null)
{
if (Module.ReadOnlyRoles != null)
if (Module.ReadOnlyRoles.Contains(role))
DisableControls = true;
}
// disable controls (if required)
if (DisableControls)
DisableFormControls(this, ExcludeDisableControls.ToArray());

View file

@ -46,6 +46,7 @@ namespace WebsitePanel.Portal
private const string DEFAULT_ADMIN_ROLE = "WebsitePanel Administrators";
private const string DEFAULT_RESELLER_ROLE = "WebsitePanel Resellers";
private const string DEFAULT_CSR_ROLE = "CSR";
private const string DEFAULT_USER_ROLE = "WebsitePanel Users";
#region Users ODS Methods (for Selected User)