mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 12:13:33 +08:00
fix wrong data when a tool specified in the allow list is not installed
This commit is contained in:
@@ -52,26 +52,32 @@ class SanitizeAllowController(BaseAPIController):
|
||||
|
||||
def _generate_allowlist(self, trans):
|
||||
sanitize_dict = dict(blocked_toolshed=[], allowed_toolshed=[], blocked_local=[], allowed_local=[])
|
||||
ids = None
|
||||
for tool_id in trans.app.config.sanitize_allowlist:
|
||||
installed_name = ""
|
||||
installed_ids = {'full': '',
|
||||
'allowed': tool_id,
|
||||
'owner': '',
|
||||
'repository': '',
|
||||
'tool': ''}
|
||||
for toolbox_id in trans.app.toolbox.tools_by_id:
|
||||
tool = trans.app.toolbox.tools_by_id[toolbox_id]
|
||||
if toolbox_id.startswith(tool_id):
|
||||
tool = trans.app.toolbox.tools_by_id[toolbox_id]
|
||||
installed_name = tool.name
|
||||
full_id = tool.id
|
||||
ids = {'full': full_id,
|
||||
'allowed': tool_id,
|
||||
'owner': '/'.join(full_id.split('/')[:3]),
|
||||
'repository': '/'.join(full_id.split('/')[:4]),
|
||||
'tool': '/'.join(full_id.split('/')[:5])}
|
||||
installed_ids = {'full': full_id,
|
||||
'allowed': tool_id,
|
||||
'owner': '/'.join(full_id.split('/')[:3]),
|
||||
'repository': '/'.join(full_id.split('/')[:4]),
|
||||
'tool': '/'.join(full_id.split('/')[:5])}
|
||||
break
|
||||
tool_dict = dict(tool_name=tool.name, tool_id=tool_id.split('/'), ids=ids, allowed=True, toolshed='/' in tool_id)
|
||||
tool_dict = dict(tool_name=installed_name, tool_id=tool_id.split('/'), ids=installed_ids, allowed=True, toolshed='/' in tool_id)
|
||||
if '/' in tool_id:
|
||||
sanitize_dict['allowed_toolshed'].append(tool_dict)
|
||||
else:
|
||||
sanitize_dict['allowed_local'].append(tool_dict)
|
||||
for tool_id in sorted(trans.app.toolbox.tools_by_id):
|
||||
tool = trans.app.toolbox.tools_by_id[tool_id]
|
||||
if not tool_id.startswith(tuple(trans.app.config.sanitize_allowlist)):
|
||||
tool = trans.app.toolbox.tools_by_id[tool_id]
|
||||
ids = {'full': tool_id,
|
||||
'owner': '/'.join(tool_id.split('/')[:3]),
|
||||
'repository': '/'.join(tool_id.split('/')[:4]),
|
||||
|
||||
Reference in New Issue
Block a user