From 6aec4ea281e862d7fc65fbb7a93d743ee776a99e Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Sat, 29 Jan 2022 01:40:37 +0000 Subject: [PATCH] CP-38893: Make internal roles unavailable for selection. Signed-off-by: Konstantina Chremmou --- XenAdmin/Dialogs/RoleSelectionDialog.cs | 4 +++- XenModel/Actions/AD/AddRemoveRolesAction.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/XenAdmin/Dialogs/RoleSelectionDialog.cs b/XenAdmin/Dialogs/RoleSelectionDialog.cs index d13fbdba0..763f2a853 100644 --- a/XenAdmin/Dialogs/RoleSelectionDialog.cs +++ b/XenAdmin/Dialogs/RoleSelectionDialog.cs @@ -82,7 +82,9 @@ namespace XenAdmin.Dialogs } // Get the list of roles off the server and arrange them into rank - var serverRoles = connection.Cache.Roles.Where(r => r.subroles.Count > 0).OrderBy(r => r).Reverse().ToList(); + var serverRoles = connection.Cache.Roles + .Where(r => (!Helpers.Post82X(connection) || !r.is_internal) && r.subroles.Count > 0) + .OrderBy(r => r).Reverse().ToList(); _subjectsPerRole = new Dictionary>(); foreach (Role role in serverRoles) diff --git a/XenModel/Actions/AD/AddRemoveRolesAction.cs b/XenModel/Actions/AD/AddRemoveRolesAction.cs index f931cf038..706e06cb7 100644 --- a/XenModel/Actions/AD/AddRemoveRolesAction.cs +++ b/XenModel/Actions/AD/AddRemoveRolesAction.cs @@ -63,7 +63,9 @@ namespace XenAdmin.Actions protected override void Run() { - var serverRoles = Connection.Cache.Roles.Where(r => r.subroles.Count > 0).ToList(); + var serverRoles = Connection.Cache.Roles + .Where(r => (!Helpers.Post82X(Connection) || !r.is_internal) && r.subroles.Count > 0) + .ToList(); var toAdd = serverRoles.Where(role => _newRoles.Contains(role) && !subject.roles.Contains(new XenRef(role.opaque_ref))).ToList();