mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 12:30:50 +01:00
Exclude internal roles from friendly listing on UI and logs.
Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
This commit is contained in:
parent
c822c87af2
commit
2a1685e40f
@ -30,6 +30,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Network;
|
||||
|
||||
@ -49,17 +50,17 @@ namespace XenAPI
|
||||
|
||||
public string FriendlyName()
|
||||
{
|
||||
return FriendlyNameManager.GetFriendlyName(string.Format("Role.{0}.NameLabel", name_label.ToLowerInvariant()));
|
||||
return FriendlyNameManager.GetFriendlyName($"Role.{name_label.ToLowerInvariant()}.NameLabel");
|
||||
}
|
||||
|
||||
public static string FriendlyName(string role)
|
||||
{
|
||||
return FriendlyNameManager.GetFriendlyName(string.Format("Role.{0}.NameLabel", role.ToLowerInvariant()));
|
||||
return FriendlyNameManager.GetFriendlyName($"Role.{role.ToLowerInvariant()}.NameLabel");
|
||||
}
|
||||
|
||||
public string FriendlyDescription()
|
||||
{
|
||||
return FriendlyNameManager.GetFriendlyName(string.Format("Role.{0}.Description", this.name_label.ToLowerInvariant()));
|
||||
return FriendlyNameManager.GetFriendlyName($"Role.{name_label.ToLowerInvariant()}.Description");
|
||||
}
|
||||
|
||||
public override string Name()
|
||||
@ -70,7 +71,7 @@ namespace XenAPI
|
||||
/// <summary>
|
||||
/// Currently all RBAC roles can be arranged in a rank so that each one has all the privileges of the next. Use this function for sorting based on this ordering.
|
||||
/// </summary>
|
||||
public int RoleRank()
|
||||
private int RoleRank()
|
||||
{
|
||||
switch (name_label.ToLowerInvariant())
|
||||
{
|
||||
@ -102,14 +103,14 @@ namespace XenAPI
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Takes a list of role objects and returns as a comma separated friendly string
|
||||
/// Takes a list of role objects and returns as a comma separated friendly string.
|
||||
/// Note that it excludes xapi internal roles.
|
||||
/// </summary>
|
||||
public static string FriendlyCsvRoleList(List<Role> roles)
|
||||
{
|
||||
if (roles == null)
|
||||
return "";
|
||||
|
||||
return String.Join(", ", roles.ConvertAll(r => r.FriendlyName()).ToArray());
|
||||
return roles == null
|
||||
? string.Empty
|
||||
: string.Join(", ", roles.Where(r => !r._is_internal).Select(r => r.FriendlyName()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user