From ba5fe3f48ad152dfc5e84b9ee8d88c60422260c5 Mon Sep 17 00:00:00 2001 From: John Davis Date: Fri, 10 Jan 2025 01:26:07 -0500 Subject: [PATCH 1/7] Do not display public pages authored by deleted users We check for both deleted and purged because their may be older galaxy instances with user records that are purged but not deleted. --- lib/galaxy/managers/pages.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/galaxy/managers/pages.py b/lib/galaxy/managers/pages.py index 101d785c688e..6a72d7edcd4d 100644 --- a/lib/galaxy/managers/pages.py +++ b/lib/galaxy/managers/pages.py @@ -18,6 +18,7 @@ import sqlalchemy from sqlalchemy import ( + and_, desc, false, func, @@ -158,6 +159,10 @@ def index_query( stmt = select(self.model_class) + # Do not include pages authored by deleted users + if show_published: + stmt = stmt.join(Page.user).where(and_(User.deleted == false(), User.purged == false())) + filters = [] if show_own or (not show_published and not show_shared and not is_admin): filters = [self.model_class.user == user] From 324ecb875ad0a400a1bd11bf46abee4f94012f71 Mon Sep 17 00:00:00 2001 From: John Davis Date: Fri, 10 Jan 2025 17:33:56 -0500 Subject: [PATCH 2/7] Do not display public and shared workflows authored by deleted users --- lib/galaxy/managers/workflows.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/galaxy/managers/workflows.py b/lib/galaxy/managers/workflows.py index ecb0b7a719ae..e7ad9fc98413 100644 --- a/lib/galaxy/managers/workflows.py +++ b/lib/galaxy/managers/workflows.py @@ -197,6 +197,11 @@ def index_query( filters.append(StoredWorkflow.published == true()) stmt = select(StoredWorkflow) + + # Do not include workflows authored by deleted users + if show_published or show_shared: + stmt = stmt.join(StoredWorkflow.user).where(and_(User.deleted == false(), User.purged == false())) + if show_shared: stmt = stmt.outerjoin(StoredWorkflow.users_shared_with) stmt = stmt.outerjoin(StoredWorkflow.tags) From 9030721beb1d57475c3075ecf4652de4e2d3cb8c Mon Sep 17 00:00:00 2001 From: John Davis Date: Mon, 13 Jan 2025 17:04:03 -0500 Subject: [PATCH 3/7] Expose Page.author_deleted_or_purged --- client/src/api/schema/schema.ts | 10 ++++++++++ lib/galaxy/model/__init__.py | 6 ++++++ lib/galaxy/schema/schema.py | 5 +++++ 3 files changed, 21 insertions(+) diff --git a/client/src/api/schema/schema.ts b/client/src/api/schema/schema.ts index 3a7c79e4de31..c59c58093a7e 100644 --- a/client/src/api/schema/schema.ts +++ b/client/src/api/schema/schema.ts @@ -14717,6 +14717,11 @@ export interface components { PageContentFormat: "markdown" | "html"; /** PageDetails */ PageDetails: { + /** + * Author deleted or purged + * @description Whether the author of this Page has been deleted or purged. + */ + author_deleted_or_purged: boolean; /** * Content * @description Raw text contents of the last page revision (type dependent on content_format). @@ -14815,6 +14820,11 @@ export interface components { }; /** PageSummary */ PageSummary: { + /** + * Author deleted or purged + * @description Whether the author of this Page has been deleted or purged. + */ + author_deleted_or_purged: boolean; /** * Create Time * Format: date-time diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 1ec69bab1c74..dec26e0a3bdf 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -10491,6 +10491,7 @@ class Page(Base, HasTags, Dictifiable, RepresentById, UsesCreateAndUpdateTime): "deleted", "username", "email_hash", + "author_deleted_or_purged", "create_time", "update_time", ] @@ -10517,6 +10518,11 @@ def username(self): def email_hash(self): return md5_hash_str(self.user.email) + # needed to determine how to display page details + @property + def author_deleted_or_purged(self): + return self.user.deleted or self.user.purged + class PageRevision(Base, Dictifiable, RepresentById): __tablename__ = "page_revision" diff --git a/lib/galaxy/schema/schema.py b/lib/galaxy/schema/schema.py index e33053fed0d0..285bcf436cc3 100644 --- a/lib/galaxy/schema/schema.py +++ b/lib/galaxy/schema/schema.py @@ -3788,6 +3788,11 @@ class PageSummary(PageSummaryBase, WithModelClass): title="Encoded email", description="The encoded email of the user.", ) + author_deleted_or_purged: bool = Field( + ..., # Required + title="Author deleted or purged", + description="Whether the author of this Page has been deleted or purged.", + ) published: bool = Field( ..., # Required title="Published", From 3082bb9be40402636f9d65fd6b8bc708343a956f Mon Sep 17 00:00:00 2001 From: John Davis Date: Mon, 13 Jan 2025 17:04:58 -0500 Subject: [PATCH 4/7] Use author_deleted_or_purged to determine how to display page author --- client/src/components/Common/PublishedItem.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/src/components/Common/PublishedItem.vue b/client/src/components/Common/PublishedItem.vue index 6b505ee2b004..4f248118f7fa 100644 --- a/client/src/components/Common/PublishedItem.vue +++ b/client/src/components/Common/PublishedItem.vue @@ -12,6 +12,7 @@ interface Item { owner?: string; username?: string; email_hash?: string; + author_deleted_or_purged?: boolean; tags?: string[]; title?: string; } @@ -37,8 +38,14 @@ const plural = computed(() => { return `${modelTitle.value}s`; }); +const owner = computed(() => { + if (props.item?.author_deleted_or_purged) { + return "Archived author"; + } + return props.item?.owner ?? props.item?.username ?? "Unavailable"; +}); + const gravatarSource = computed(() => `https://secure.gravatar.com/avatar/${props.item?.email_hash}?d=identicon`); -const owner = computed(() => props.item?.owner ?? props.item?.username ?? "Unavailable"); const pluralPath = computed(() => plural.value.toLowerCase()); const publishedByUser = computed(() => `/${pluralPath.value}/list_published?f-username=${owner.value}`); const urlAll = computed(() => `/${pluralPath.value}/list_published`); @@ -76,7 +83,7 @@ const urlAll = computed(() => `/${pluralPath.value}/list_published`); All published {{ plural }} -
+
Published {{ plural }} by {{ owner }}
From cac1195122a36580cc6167263bf8261492a3c9df Mon Sep 17 00:00:00 2001 From: John Davis Date: Tue, 14 Jan 2025 01:11:37 -0500 Subject: [PATCH 5/7] Expose StoredWorkflow.creator_deleted_or_purged --- client/src/api/schema/schema.ts | 5 +++++ lib/galaxy/model/__init__.py | 1 + lib/galaxy/schema/workflows.py | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/client/src/api/schema/schema.ts b/client/src/api/schema/schema.ts index c59c58093a7e..f390477a650e 100644 --- a/client/src/api/schema/schema.ts +++ b/client/src/api/schema/schema.ts @@ -16374,6 +16374,11 @@ export interface components { creator?: | (components["schemas"]["Person"] | components["schemas"]["galaxy__schema__schema__Organization"])[] | null; + /** + * Creator deleted or purged + * @description Whether the creator of this Workflow has been deleted or purged. + */ + creator_deleted_or_purged: boolean; /** * Deleted * @description Whether this item is marked as deleted. diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index dec26e0a3bdf..f702ebc4fb79 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -7859,6 +7859,7 @@ def to_dict(self, view="collection", value_mapper=None): rval["latest_workflow_uuid"] = (lambda uuid: str(uuid) if self.latest_workflow.uuid else None)( self.latest_workflow.uuid ) + rval["creator_deleted_or_purged"] = self.user.deleted or self.user.purged return rval diff --git a/lib/galaxy/schema/workflows.py b/lib/galaxy/schema/workflows.py index fbe447108161..a4a8eb30c3b6 100644 --- a/lib/galaxy/schema/workflows.py +++ b/lib/galaxy/schema/workflows.py @@ -225,6 +225,11 @@ class StoredWorkflowDetailed(StoredWorkflowSummary): title="Creator", description=("Additional information about the creator (or multiple creators) of this workflow."), ) + creator_deleted_or_purged: bool = Field( + ..., + title="Creator deleted or purged", + description="Whether the creator of this Workflow has been deleted or purged.", + ) steps: Dict[ int, Annotated[ From dfba8ca818bf35b00a3a2001e56ec2fd7815d047 Mon Sep 17 00:00:00 2001 From: John Davis Date: Tue, 14 Jan 2025 01:12:28 -0500 Subject: [PATCH 6/7] Use creator_deleted_or_purged to determine how to display workflow creator --- .../Workflow/Published/WorkflowInformation.vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/client/src/components/Workflow/Published/WorkflowInformation.vue b/client/src/components/Workflow/Published/WorkflowInformation.vue index dc41bdd27c85..dddefaa8c6d6 100644 --- a/client/src/components/Workflow/Published/WorkflowInformation.vue +++ b/client/src/components/Workflow/Published/WorkflowInformation.vue @@ -43,6 +43,13 @@ const fullLink = computed(() => { const userOwned = computed(() => { return userStore.matchesCurrentUsername(props.workflowInfo.owner); }); + +const owner = computed(() => { + if (props.workflowInfo?.creator_deleted_or_purged) { + return "Archived author"; + } + return props.workflowInfo.owner; +});