Skip to content

Commit eb82336

Browse files
committed
Don't load custom tools into toolbox
1 parent ba5122a commit eb82336

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

lib/galaxy/managers/landing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def create_tool_landing_request(self, payload: CreateToolLandingRequestPayload,
6868
request_state = payload.request_state
6969

7070
ref = ToolRunReference(tool_id=tool_id, tool_version=tool_version, tool_uuid=None)
71-
tool = get_tool_from_toolbox(self.app.toolbox, ref)
71+
tool = get_tool_from_toolbox(self.app.toolbox, ref, user=None)
7272
landing_request_state = LandingRequestToolState(request_state or {})
7373
# Okay this is a hack until tool request API commit is merged, tools don't yet have a parameter
7474
# schema - so we can't do this properly.

lib/galaxy/managers/tools.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@
2424
from galaxy.managers.context import ProvidesUserContext
2525
from galaxy.model import (
2626
DynamicTool,
27+
User,
2728
UserDynamicToolAssociation,
2829
)
2930
from galaxy.tool_util.cwl import tool_proxy
3031
from galaxy.tool_util.parser.yaml import YamlToolSource
32+
from galaxy.tool_util.toolbox import AbstractToolBox
3133
from galaxy.tool_util_models.dynamic_tool_models import (
3234
DynamicToolPayload,
3335
DynamicUnprivilegedToolCreatePayload,
@@ -61,17 +63,13 @@ class ToolRunReference(NamedTuple):
6163

6264

6365
def get_tool_from_trans(trans: ProvidesUserContext, tool_ref: ToolRunReference) -> Tool:
64-
return get_tool_from_toolbox(trans.app.toolbox, tool_ref)
66+
return get_tool_from_toolbox(trans.app.toolbox, tool_ref, trans.user)
6567

6668

67-
def get_tool_from_toolbox(toolbox, tool_ref: ToolRunReference) -> Tool:
68-
get_kwds = dict(
69-
tool_id=tool_ref.tool_id,
70-
tool_uuid=tool_ref.tool_uuid,
71-
tool_version=tool_ref.tool_version,
69+
def get_tool_from_toolbox(toolbox: AbstractToolBox, tool_ref: ToolRunReference, user: Optional[User]) -> Tool:
70+
tool = toolbox.get_tool(
71+
tool_id=tool_ref.tool_id, tool_uuid=tool_ref.tool_uuid, tool_version=tool_ref.tool_version, user=user
7272
)
73-
74-
tool = toolbox.get_tool(**get_kwds)
7573
if not tool:
7674
log.debug(f"Not found tool with kwds [{tool_ref}]")
7775
raise exceptions.ToolMissingException("Tool not found.")
@@ -102,7 +100,7 @@ def get_tool_by_id_or_uuid(self, id_or_uuid: Union[int, str]) -> Union[DynamicTo
102100
return self.get_tool_by_uuid(id_or_uuid)
103101

104102
def get_tool_by_uuid(self, uuid: Optional[Union[UUID, str]]):
105-
stmt = select(DynamicTool).where(DynamicTool.uuid == uuid)
103+
stmt = select(DynamicTool).where(DynamicTool.uuid == uuid, DynamicTool.public == true())
106104
return self.session().scalars(stmt).one_or_none()
107105

108106
def get_tool_by_tool_id(self, tool_id):

lib/galaxy/tool_util/toolbox/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ def panel_has_tool(self, tool: "Tool", panel_view_id: str) -> bool:
412412
return panel_view_rendered.has_item_recursive(tool)
413413

414414
def load_dynamic_tool(self, dynamic_tool: "DynamicTool") -> Union["Tool", None]:
415-
if not dynamic_tool.active:
415+
if not dynamic_tool.active or not dynamic_tool.public:
416416
return None
417417

418418
tool = self.create_dynamic_tool(dynamic_tool)

test/unit/app/managers/test_landing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def toolbox(self):
5454

5555
class MockToolbox:
5656

57-
def get_tool(self, tool_id, tool_uuid, tool_version):
57+
def get_tool(self, tool_id, tool_uuid, tool_version, user):
5858
return MockTool()
5959

6060

0 commit comments

Comments
 (0)