mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #14289 from mvdbeek/fix_display_as_traceback
[22.05] Fix display_as with authz_method=rbac
This commit is contained in:
@@ -500,7 +500,7 @@ class GalaxyRBACAgent(RBACAgent):
|
||||
def item_permission_map_for_add(self, trans, user_roles, libitems):
|
||||
return self.allow_action_on_libitems(trans, user_roles, self.permitted_actions.LIBRARY_ADD, libitems)
|
||||
|
||||
def can_access_dataset(self, user_roles, dataset):
|
||||
def can_access_dataset(self, user_roles, dataset: galaxy.model.Dataset):
|
||||
# SM: dataset_is_public will access dataset.actions, which is a
|
||||
# backref that causes a query to be made to DatasetPermissions
|
||||
retval = self.dataset_is_public(dataset) or self.allow_action(
|
||||
@@ -1122,7 +1122,7 @@ class GalaxyRBACAgent(RBACAgent):
|
||||
if not dataset.purged and not self.dataset_is_public(dataset):
|
||||
self.make_dataset_public(dataset)
|
||||
|
||||
def dataset_is_public(self, dataset):
|
||||
def dataset_is_public(self, dataset: galaxy.model.Dataset):
|
||||
"""
|
||||
A dataset is considered public if there are no "access" actions
|
||||
associated with it. Any other actions ( 'manage permissions',
|
||||
|
||||
@@ -107,8 +107,9 @@ class RootController(controller.JSAppLauncher, UsesAnnotations):
|
||||
if "authz_method" in kwd:
|
||||
authz_method = kwd["authz_method"]
|
||||
if data:
|
||||
current_user_roles = trans.get_current_user_roles()
|
||||
if authz_method == "rbac" and trans.app.security_agent.can_access_dataset(current_user_roles, data):
|
||||
if authz_method == "rbac" and trans.app.security_agent.can_access_dataset(
|
||||
trans.get_current_user_roles(), data.dataset
|
||||
):
|
||||
trans.response.set_content_type(data.get_mime())
|
||||
trans.log_event(f"Formatted dataset id {str(id)} for display at {display_app}")
|
||||
return data.as_display_type(display_app, **kwd)
|
||||
|
||||
Reference in New Issue
Block a user