diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs
index 703eae8a..59af6fe0 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs
@@ -63,6 +63,7 @@ namespace WebsitePanel.EnterpriseServer
public const int ERROR_USER_WRONG_PASSWORD = -110;
public const int ERROR_INVALID_USER_NAME = -111;
public const int ERROR_USER_ACCOUNT_NOT_ENOUGH_PERMISSIONS = -112;
+ public const int ERROR_USER_ACCOUNT_ROLE_NOT_ALLOWED = -113;
#endregion
#region Packages
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx
index d0195f36..63eeffa6 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx
@@ -5134,4 +5134,11 @@
Error creating organization plan. See audit log for more details.
+
+ User has not enough permissions to do this task.
+
+
+ Wrong user name or password have been specified or account is locked.
+
+
\ No newline at end of file
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalUtils.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalUtils.cs
index 2b5eb4b0..7993bf01 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalUtils.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalUtils.cs
@@ -331,11 +331,15 @@ namespace WebsitePanel.Portal
UserInfo user = authService.GetUserByUsernamePassword(username, password, ipAddress);
if (user != null)
{
- // issue authentication ticket
- FormsAuthenticationTicket ticket = CreateAuthTicket(user.Username, user.Password, user.Role, rememberLogin);
- SetAuthTicket(ticket, rememberLogin);
+ if (IsRoleAllowedToLogin(user.Role))
+ {
+ // issue authentication ticket
+ FormsAuthenticationTicket ticket = CreateAuthTicket(user.Username, user.Password, user.Role, rememberLogin);
+ SetAuthTicket(ticket, rememberLogin);
- CompleteUserLogin(username, rememberLogin, preferredLocale, theme);
+ CompleteUserLogin(username, rememberLogin, preferredLocale, theme);
+ }
+ else return BusinessErrorCodes.ERROR_USER_ACCOUNT_ROLE_NOT_ALLOWED;
}
return 0;
@@ -347,6 +351,25 @@ namespace WebsitePanel.Portal
}
}
+ private static bool IsRoleAllowedToLogin(UserRole role)
+ {
+
+ string tmp = GetExcludedRolesToLogin();
+
+ if (tmp == null) tmp = string.Empty;
+
+ string roleKey = ((UserRole)role).ToString();
+
+ return !tmp.Contains(roleKey);
+ }
+
+
+ public static string GetExcludedRolesToLogin()
+ {
+ return PortalConfiguration.SiteSettings["ExcludedRolesToLogin"];
+ }
+
+
private static int GetAuthenticationFormsTimeout()
{
//default
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj
index 2f0e726b..b23fee08 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj
@@ -221,8 +221,12 @@
-
-
+
+ Designer
+
+
+ Designer
+