diff --git a/lib/galaxy/model/security.py b/lib/galaxy/model/security.py index d8dbde46c44b..a8278d69557f 100644 --- a/lib/galaxy/model/security.py +++ b/lib/galaxy/model/security.py @@ -765,6 +765,9 @@ def create_private_user_role(self, user): return self.get_private_user_role(user) def get_private_user_role(self, user, auto_create=False): + if auto_create and user.id is None: + # New user, directly create private role + return self.create_private_user_role(user) stmt = ( select(Role) .where(