CA-188017: When checking credentials on the Health Check dialog, display a better error message when the user is not authorised to connect to the server

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2015-11-09 22:34:32 +00:00
parent 091372470f
commit 9ca480a5cd
3 changed files with 21 additions and 0 deletions

View File

@ -335,6 +335,15 @@ namespace XenAdmin.Dialogs.HealthCheck
if (elevatedSession != null && (elevatedSession.IsLocalSuperuser || SessionAuthorized(elevatedSession, Role.ValidRoleList("pool.set_health_check_config", connection))))
passedRbacChecks = true;
}
catch (Failure f)
{
if (f.ErrorDescription.Count > 0 && f.ErrorDescription[0] == Failure.RBAC_PERMISSION_DENIED)
{
// we use a different error message here from the standard one in friendly names
throw new Exception(Messages.HEALTH_CHECK_USER_HAS_NO_PERMISSION_TO_CONNECT);
}
throw;
}
finally
{
if (elevatedSession != null)

View File

@ -16265,6 +16265,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to This user is not authorized to access this server..
/// </summary>
public static string HEALTH_CHECK_USER_HAS_NO_PERMISSION_TO_CONNECT {
get {
return ResourceManager.GetString("HEALTH_CHECK_USER_HAS_NO_PERMISSION_TO_CONNECT", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This user is not authorized to perform Health Check operations..
/// </summary>

View File

@ -5749,6 +5749,9 @@ Click Configure HA to alter the settings displayed below.</value>
<data name="HEALTH_CHECK_AUTHENTICATION_INVALID_CREDENTIALS" xml:space="preserve">
<value>Invalid username or password. Please try again.</value>
</data>
<data name="HEALTH_CHECK_USER_HAS_NO_PERMISSION_TO_CONNECT" xml:space="preserve">
<value>This user is not authorized to access this server.</value>
</data>
<data name="HEALTH_CHECK_USER_NOT_AUTHORIZED" xml:space="preserve">
<value>This user is not authorized to perform Health Check operations.</value>
</data>