mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 00:12:08 +08:00
Change invocation to pass user information
This commit is contained in:
@@ -36,10 +36,21 @@ class ErrorSink(object):
|
||||
|
||||
def __init__(self, plugin_classes, plugins_source, **kwargs):
|
||||
self.extra_kwargs = kwargs
|
||||
self.app = kwargs['app']
|
||||
self.plugin_classes = plugin_classes
|
||||
self.plugins = self.__plugins_from_source(plugins_source)
|
||||
|
||||
def submit_report(self, dataset, job, tool, user_submission=False, **kwargs):
|
||||
def _can_access_dataset(self, dataset, user):
|
||||
if user:
|
||||
roles = user.all_roles()
|
||||
else:
|
||||
roles = []
|
||||
return self.app.security_agent.can_access_dataset(roles, dataset.dataset)
|
||||
|
||||
def submit_report(self, dataset, job, tool, user, user_submission=False, **kwargs):
|
||||
if user_submission:
|
||||
assert self._can_access_dataset(dataset, user), Exception("You are not allowed to access this dataset.")
|
||||
|
||||
responses = []
|
||||
for plugin in self.plugins:
|
||||
if user_submission == plugin.user_submission:
|
||||
|
||||
@@ -381,7 +381,8 @@ class JobController( BaseAPIController, UsesLibraryMixinItems ):
|
||||
job = self.__get_job( trans, id )
|
||||
tool = trans.app.toolbox.get_tool( job.tool_id, tool_version=job.tool_version ) or None
|
||||
messages = trans.app.error_reports.default_error_sink.submit_report(
|
||||
dataset, job, tool, user_submission=True, email=kwd.get('email', trans.user.email),
|
||||
dataset, job, tool, user_submission=True, user=trans.user,
|
||||
email=kwd.get('email', trans.user.email),
|
||||
message=kwd.get('message', None)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user