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:
parent
da0966657b
commit
37af5eceac
21 changed files with 423 additions and 127 deletions
|
@ -45,6 +45,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
public const string ROLE_ADMINISTRATOR = "Administrator";
|
||||
public const string ROLE_RESELLER = "Reseller";
|
||||
public const string ROLE_USER = "User";
|
||||
public const string ROLE_PLATFORMCSR = "PlatformCSR";
|
||||
public const string ROLE_PLATFORMHELPDESK = "PlatformHelpdesk";
|
||||
public const string ROLE_RESELLERCSR = "ResellerCSR";
|
||||
public const string ROLE_RESELLERHELPDESK = "ResellerHelpdesk";
|
||||
|
||||
public const string CONTEXT_USER_INFO = "CONTEXT_USER_INFO";
|
||||
|
||||
|
@ -62,8 +66,26 @@ namespace WebsitePanel.EnterpriseServer
|
|||
// set roles array
|
||||
List<string> roles = new List<string>();
|
||||
roles.Add(SecurityContext.ROLE_USER);
|
||||
|
||||
if (user.Role == UserRole.Reseller || user.Role == UserRole.Administrator ||
|
||||
user.Role == UserRole.PlatformHelpdesk || user.Role == UserRole.ResellerHelpdesk)
|
||||
roles.Add(SecurityContext.ROLE_RESELLERHELPDESK);
|
||||
|
||||
if (user.Role == UserRole.Reseller || user.Role == UserRole.Administrator ||
|
||||
user.Role == UserRole.PlatformCSR || user.Role == UserRole.ResellerCSR)
|
||||
roles.Add(SecurityContext.ROLE_RESELLERCSR);
|
||||
|
||||
if (user.Role == UserRole.Reseller || user.Role == UserRole.Administrator ||
|
||||
user.Role == UserRole.PlatformHelpdesk)
|
||||
roles.Add(SecurityContext.ROLE_PLATFORMHELPDESK);
|
||||
|
||||
if (user.Role == UserRole.Reseller || user.Role == UserRole.Administrator ||
|
||||
user.Role == UserRole.PlatformCSR)
|
||||
roles.Add(SecurityContext.ROLE_PLATFORMCSR);
|
||||
|
||||
if (user.Role == UserRole.Reseller || user.Role == UserRole.Administrator)
|
||||
roles.Add(SecurityContext.ROLE_RESELLER);
|
||||
|
||||
if (user.Role == UserRole.Administrator)
|
||||
roles.Add(SecurityContext.ROLE_ADMINISTRATOR);
|
||||
|
||||
|
@ -152,9 +174,40 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
// should make a check if the account has Admin role
|
||||
if (!User.IsInRole(ROLE_RESELLER))
|
||||
return BusinessErrorCodes.ERROR_USER_ACCOUNT_SHOULD_BE_RESELLER;
|
||||
return BusinessErrorCodes.ERROR_USER_ACCOUNT_NOT_ENOUGH_PERMISSIONS;
|
||||
}
|
||||
|
||||
if ((demand & DemandAccount.IsPlatformCSR) == DemandAccount.IsPlatformCSR)
|
||||
{
|
||||
// should make a check if the account has Admin role
|
||||
if (!User.IsInRole(ROLE_PLATFORMCSR))
|
||||
return BusinessErrorCodes.ERROR_USER_ACCOUNT_NOT_ENOUGH_PERMISSIONS;
|
||||
}
|
||||
|
||||
if ((demand & DemandAccount.IsPlatformHelpdesk) == DemandAccount.IsPlatformHelpdesk)
|
||||
{
|
||||
// should make a check if the account has Admin role
|
||||
if (!User.IsInRole(ROLE_PLATFORMHELPDESK))
|
||||
return BusinessErrorCodes.ERROR_USER_ACCOUNT_NOT_ENOUGH_PERMISSIONS;
|
||||
}
|
||||
|
||||
|
||||
if ((demand & DemandAccount.IsResellerHelpdesk) == DemandAccount.IsResellerHelpdesk)
|
||||
{
|
||||
// should make a check if the account has Admin role
|
||||
if (!User.IsInRole(ROLE_RESELLERHELPDESK))
|
||||
return BusinessErrorCodes.ERROR_USER_ACCOUNT_NOT_ENOUGH_PERMISSIONS;
|
||||
}
|
||||
|
||||
|
||||
if ((demand & DemandAccount.IsResellerCSR) == DemandAccount.IsResellerCSR)
|
||||
{
|
||||
// should make a check if the account has Admin role
|
||||
if (!User.IsInRole(ROLE_RESELLERCSR))
|
||||
return BusinessErrorCodes.ERROR_USER_ACCOUNT_NOT_ENOUGH_PERMISSIONS;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue