diff --git a/lib/galaxy/files/__init__.py b/lib/galaxy/files/__init__.py index 58aea54181be..eb3542982883 100644 --- a/lib/galaxy/files/__init__.py +++ b/lib/galaxy/files/__init__.py @@ -360,6 +360,9 @@ def user_vault(self) -> Dict[str, Any]: ... @property def app_vault(self) -> Dict[str, Any]: ... + @property + def anonymous(self) -> bool: ... + OptionalUserContext = Optional[FileSourcesUserContext] @@ -422,6 +425,10 @@ def app_vault(self): def file_sources(self): return self.trans.app.file_sources + @property + def anonymous(self) -> bool: + return self.trans.anonymous + class DictFileSourcesUserContext(FileSourcesUserContext, FileSourceDictifiable): def __init__(self, **kwd): @@ -466,3 +473,7 @@ def app_vault(self): @property def file_sources(self): return self._kwd.get("file_sources") + + @property + def anonymous(self) -> bool: + return bool(self._kwd.get("username")) diff --git a/lib/galaxy/managers/file_source_instances.py b/lib/galaxy/managers/file_source_instances.py index ba3bacde540e..e4e938a457ec 100644 --- a/lib/galaxy/managers/file_source_instances.py +++ b/lib/galaxy/managers/file_source_instances.py @@ -483,6 +483,9 @@ def user_file_sources_to_dicts( exclude_kind: Optional[Set[PluginKind]] = None, ) -> List[FilesSourceProperties]: """Write out user file sources as list of config dictionaries.""" + if user_context.anonymous: + return [] + as_dicts = [] for files_source_properties in self._all_user_file_source_properties(user_context): plugin_kind = PluginKind.rfs