From 5d7fdeb6ba55afa12500926a0944a5a9a121c06f Mon Sep 17 00:00:00 2001 From: John Davis Date: Wed, 9 Oct 2024 15:43:13 -0400 Subject: [PATCH] Fix set of role names - Add user email to represent user's private role - Exclude generic role names --- lib/galaxy/files/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/files/__init__.py b/lib/galaxy/files/__init__.py index b13b2e1db8c8..d2c08059548d 100644 --- a/lib/galaxy/files/__init__.py +++ b/lib/galaxy/files/__init__.py @@ -396,7 +396,15 @@ def preferences(self): def role_names(self) -> Set[str]: """The set of role names of this user.""" user = self.trans.user - return {ura.role.name for ura in user.roles} if user else set() + role_names = {ura.role.name for ura in user.roles} if user else set() + # Exclude generic role names + # TODO refactor to use Role.default_name (can't import Role) + sharing_role = "sharing role" + private_role = "private role" + role_names = role_names - {sharing_role, private_role} + # Add user email to identify their private role + role_names.add(user.email) + return role_names @property def group_names(self) -> Set[str]: