1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/2057558b6c91/
changeset: 2057558b6c91
user: dan
date: 2012-09-28 15:19:20
summary: Fix for __get_tool_components when a tool is not loaded, but the item is still listed in the tool panel (due to not refreshing the page).
affected #: 1 file
diff -r 508b95f2912926ae954d6b7e16aaac4408c85eec -r 2057558b6c91b59a94da493e7490a5f7ba9db6ba lib/galaxy/web/controllers/tool_runner.py
--- a/lib/galaxy/web/controllers/tool_runner.py
+++ b/lib/galaxy/web/controllers/tool_runner.py
@@ -43,6 +43,7 @@
toolbox = self.get_toolbox()
tool_version_select_field = None
tools = []
+ tool = None
# Backwards compatibility for datasource tools that have default tool_id configured, but which are now using only GALAXY_URL.
tool_ids = util.listify( tool_id )
for tool_id in tool_ids:
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/508b95f29129/
changeset: 508b95f29129
user: smcmanus
date: 2012-09-28 00:03:53
summary: Removed dead code
affected #: 1 file
diff -r 2a2bc1ee4ac7557014a50549e8a8c32746a6ca96 -r 508b95f2912926ae954d6b7e16aaac4408c85eec lib/galaxy/web/controllers/library_common.py
--- a/lib/galaxy/web/controllers/library_common.py
+++ b/lib/galaxy/web/controllers/library_common.py
@@ -93,64 +93,6 @@
}
return rval
- def display_folder_hierarchy( self, trans_in, cntrller_in, use_panels_in, library_in, created_ldda_ids_in, hidden_folder_ids_in, show_deleted_in, comptypes_in, current_user_roles_in, message_in, status ):
- log.debug( "display_folder_hierarchy: enter" )
- # SM: Determine if this is an admin user (trans.user_is_admin and cntrller
- # is library_admin). If so, then the user gets add, modify, manage permissions.
- # Otherwise, if this is the library/requests controller then lookup those
- # three permissions. Otherwise, it's all not true.
- #
- # Now get the library's info_assocation (?). TODO: Look into this.
- # Determine if there are accessible folders:
- # 1. Is the root folder accessible to this user?
- # 2. IS the root folder accessible to this user (without looking downward)?
- # 3. Is this guy an admin OR is the root folder accessible to this user?
- # Evidently roles are used each time.
- #
- # Then show management buttons and links, and then call render_folders
-
- # render_folder:
- # Repeat determining if this is an admin user:
- # is_admin = trans.user_is_admin() and cntrller == 'library_admin'
- # Turn the list of created lddas into a list - split by comma, turn one
- # element into its own list, and leave lists alone.
- # (Christ) If this is an admin user, then all permissions are granted.
- # O.w., if this is the library controller,
- # determine the folder ids along with whether the folders can be
- # shown, and determine the other three admin permissions.
- # O.w., no modifications are allowed - it's view-only.
- # Get the form type and (sigh) again get the folder's info_association (?)
- # Display information about the folder.
- # Get the list of deleted (if shown) and non-deleted datasets and subfolders.
- # Call render_folder for every subfolder
- # For every library dataset, determine the ldda. If there is an ldda, then
- # determine if the ldda's dataset can be displayed.
-
- # TODO: Move this to a security function/method later.
- is_admin = trans.user_is_admin() and cntrller == 'library_admin'
-
- if is_admin:
- can_add = can_modify = can_manage = True
- elif cntrller in [ 'library', 'requests' ]:
- can_add = trans.app.security_agent.can_add_library_item( current_user_roles_in, library )
- can_modify = trans.app.security_agent.can_modify_library_item( current_user_roles_in, library )
- can_manage = trans.app.security_agent.can_manage_library_item( current_user_roles_in, library )
- else:
- can_add = can_modify = can_manage = False
-
- info_association, inherited = library_in.get_info_association()
- log.debug( "type(info_association): %s" % type(info_association) )
- log.debug( "type(inherited): %s" % type(inherited) )
-
- # SM: determine if folders are accessible underneath here:
- has_accessible_folders = is_admin or trans.app.security_agent.has_accessible_folders( trans, library.root_folder, trans.user, current_user_roles_in )
- if has_accessible_folders and cntrller in ['library', 'requests']:
- self.display_folder( 'library', library.root_folder, 0, created_ldda_ids, library, hidden_folder_ids, tracked_datasets, show_deleted = show_deleted, parent=None, root_folder=True, simple=simple )
- elif ( trans_in.user_is_admin() and cntrller in [ 'library_admin', 'requests_admin' ] ):
- # SM: TODO: Start here.
- pass
- pass
-
@web.expose
def browse_library( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
@@ -187,34 +129,22 @@
message += "message \"This job is running\" is cleared from the \"Information\" column below for each selected dataset."
status = "info"
comptypes = get_comptypes( trans )
- # SM: Retrieve the entire hierarchy and pass it to the template to fill in.
- # We'll eliminate the mako from retrieving stuff for now.
- # SM: TODO: Add configuration item
- # if trans.app.config.optimize_folders:
- if False:
- hierarchy = self.display_folder_hierarchy( trans, cntrller, use_panels, library,
- created_ldda_ids, hidden_folder_ids,
- show_deleted, comptypes,
- current_user_roles, message,
- status )
-
- else:
- try:
- # SM: TODO: Add configuration variable asap.
- return trans.fill_template( '/library/common/browse_library.mako',
- cntrller=cntrller,
- use_panels=use_panels,
- library=library,
- created_ldda_ids=created_ldda_ids,
- hidden_folder_ids=hidden_folder_ids,
- show_deleted=show_deleted,
- comptypes=comptypes,
- current_user_roles=current_user_roles,
- message=message,
- status=status )
- except Exception, e:
- message = 'Error attempting to display contents of library (%s): %s.' % ( str( library.name ), str( e ) )
- status = 'error'
+ try:
+ # SM: TODO: Add configuration variable asap.
+ return trans.fill_template( '/library/common/browse_library.mako',
+ cntrller=cntrller,
+ use_panels=use_panels,
+ library=library,
+ created_ldda_ids=created_ldda_ids,
+ hidden_folder_ids=hidden_folder_ids,
+ show_deleted=show_deleted,
+ comptypes=comptypes,
+ current_user_roles=current_user_roles,
+ message=message,
+ status=status )
+ except Exception, e:
+ message = 'Error attempting to display contents of library (%s): %s.' % ( str( library.name ), str( e ) )
+ status = 'error'
default_action = params.get( 'default_action', None )
return trans.response.send_redirect( web.url_for( use_panels=use_panels,
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/048e0743316c/
changeset: 048e0743316c
user: smcmanus
date: 2012-09-27 23:49:28
summary: The fourth optimized query was being emitted due to other calls to get_item_actions; this fixes that case.
affected #: 2 files
diff -r 8fcb6ed6e2336542bb122cbac70c3150464cbbf1 -r 048e0743316c67570062b13da2c3dcf7dcc1924c lib/galaxy/security/__init__.py
--- a/lib/galaxy/security/__init__.py
+++ b/lib/galaxy/security/__init__.py
@@ -324,7 +324,7 @@
return ret_permissions
- def allow_action_on_items( self, trans, user_roles, action, items ):
+ def allow_action_on_libitems( self, trans, user_roles, action, items ):
"""
This should be the equivalent of allow_action defined on multiple items.
It is meant to specifically replace allow_action for multiple
@@ -379,19 +379,56 @@
return ret_allow_action
- def get_dataset_access_mapping( self, trans, user_roles, datasets ):
+ # DELETEME: SM: DO NOT TOUCH! This actually works.
+ def dataset_access_mapping( self, trans, user_roles, datasets ):
'''
For the given list of datasets, return a mapping of the datasets' ids
to whether they can be accessed by the user or not. The datasets input
is expected to be a simple list of Dataset objects.
'''
datasets_public_map = self.datasets_are_public( trans, datasets )
- datasets_allow_action_map = self.allow_action_on_items( trans, user_roles, self.permitted_actions.DATASET_ACCESS, datasets )
+ datasets_allow_action_map = self.allow_action_on_libitems( trans, user_roles, self.permitted_actions.DATASET_ACCESS, datasets )
can_access = {}
for dataset in datasets:
can_access[ dataset.id ] = datasets_public_map[ dataset.id ] or datasets_allow_action_map[ dataset.id ]
return can_access
+ def dataset_permission_map_for_access( self, trans, user_roles, libitems ):
+ '''
+ For a given list of library items (e.g., Datasets), return a map of the
+ datasets' ids to whether they can have permission to use that action
+ (e.g., "access" or "modify") on the dataset. The libitems input is
+ expected to be a simple list of library items, such as Datasets or
+ LibraryDatasets.
+ NB: This is currently only usable for Datasets; it was intended to
+ be used for any library item.
+ '''
+ # Map the library items to whether they are publicly accessible or not.
+ # Then determine what actions are allowed on the item (in case it's not
+ # public). Finally, the item is accessible if it's publicly available
+ # or the right permissions are enabled.
+ # TODO: This only works for Datasets; other code is using X_is_public,
+ # so this will have to be rewritten to support other items.
+ libitems_public_map = self.datasets_are_public( trans, libitems )
+ libitems_allow_action_map = self.allow_action_on_libitems(
+ trans, user_roles, self.permitted_actions.DATASET_ACCESS, libitems )
+ can_access = {}
+ for libitem in libitems:
+ can_access[ libitem.id ] = libitems_public_map[ libitem.id ] or libitems_allow_action_map[ libitem.id ]
+ return can_access
+
+ def item_permission_map_for_modify( self, trans, user_roles, libitems ):
+ return self.allow_action_on_libitems(
+ trans, user_roles, self.permitted_actions.LIBRARY_MODIFY, libitems )
+
+ def item_permission_map_for_manage( self, trans, user_roles, libitems ):
+ return self.allow_action_on_libitems(
+ trans, user_roles, self.permitted_actions.LIBRARY_MANAGE, libitems )
+
+ 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 ):
# SM: dataset_is_public will access dataset.actions, which is a
# backref that causes a query to be made to DatasetPermissions
diff -r 8fcb6ed6e2336542bb122cbac70c3150464cbbf1 -r 048e0743316c67570062b13da2c3dcf7dcc1924c templates/library/common/browse_library_opt.mako
--- a/templates/library/common/browse_library_opt.mako
+++ b/templates/library/common/browse_library_opt.mako
@@ -207,7 +207,7 @@
</script></%def>
-<%def name="render_dataset( cntrller, ldda, library_dataset, selected, library, folder, pad, parent, row_counter, tracked_datasets, show_deleted=False, simple=False )">
+<%def name="render_dataset( cntrller, ldda, library_dataset, can_modify, can_manage, selected, library, folder, pad, parent, row_counter, tracked_datasets, show_deleted=False, simple=False )"><%
## The received ldda must always be a LibraryDatasetDatasetAssociation object. The object id passed to methods
## from the drop down menu should be the ldda id to prevent id collision ( which could happen when displaying
@@ -215,29 +215,15 @@
## library_dataset, so we display the attributes from the ldda.
from galaxy.web.controllers.library_common import branch_deleted
- # SM: DELETEME
- import logging
- log = logging.getLogger( __name__ )
-
+
is_admin = trans.user_is_admin() and cntrller == 'library_admin'
-
- if ldda == library_dataset.library_dataset_dataset_association:
- current_version = True
- if is_admin:
- can_modify = can_manage = True
- elif cntrller in [ 'library', 'requests' ]:
- #log.debug( "SM: Query 4: backref to Library_Dataset_Permissions" )
- can_modify = trans.app.security_agent.can_modify_library_item( current_user_roles, library_dataset )
- can_manage = trans.app.security_agent.can_manage_library_item( current_user_roles, library_dataset )
- else:
- can_modify = can_manage = False
- else:
- current_version = False
+ current_version = ( ldda == library_dataset.library_dataset_dataset_association )
if current_version and ldda.state not in ( 'ok', 'error', 'empty', 'deleted', 'discarded' ):
tracked_datasets[ldda.id] = ldda.state
- #log.debug( "SM: Query 5 call: LibraryDatasetDatasetInfoAssocation" )
+ # SM: This causes a query to be emitted, but it quickly goes down a
+ # rabbit hole of many possible inheritable cases. It may not be
+ # possible to easily eliminate the extra query from this call.
info_association, inherited = ldda.get_info_association( restrict=True )
- # SM: The form type is for displaying URLs only; ignore for now.
form_type = trans.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE
%>
%if current_version and ( not ldda.library_dataset.deleted or show_deleted ):
@@ -326,7 +312,7 @@
<%def name="render_folder( cntrller, folder, folder_pad, created_ldda_ids, library, hidden_folder_ids, tracked_datasets, show_deleted=False, parent=None, row_counter=None, root_folder=False, simple=False )"><%
- from galaxy.web.controllers.library_common import active_folders, active_folders_and_library_datasets, activatable_folders_and_library_datasets, map_library_datasets_to_lddas, branch_deleted, datasets_for_lddas
+ from galaxy.web.controllers.library_common import active_folders, active_folders_and_library_datasets, activatable_folders_and_library_datasets, map_library_datasets_to_lddas, branch_deleted, datasets_for_lddas
# SM: DELETEME
from datetime import datetime, timedelta
@@ -466,14 +452,20 @@
if ( len( library_datasets ) > 0 ):
lib_dataset_ldda_map = map_library_datasets_to_lddas( trans, library_datasets )
dataset_list = datasets_for_lddas( trans, lib_dataset_ldda_map.values() )
- can_access_datasets = trans.app.security_agent.get_dataset_access_mapping( trans, current_user_roles, dataset_list )
+ #can_access_datasets = trans.app.security_agent.dataset_access_mapping( trans, current_user_roles, dataset_list )
+ can_access_datasets = trans.app.security_agent.dataset_permission_map_for_access( trans, current_user_roles, dataset_list )
+ can_modify_datasets = trans.app.security_agent.item_permission_map_for_modify( trans, current_user_roles, dataset_list )
+ can_manage_datasets = trans.app.security_agent.item_permission_map_for_manage( trans, current_user_roles, dataset_list )
for library_dataset in library_datasets:
ldda = lib_dataset_ldda_map[ library_dataset.id ]
if ldda:
+ # SMTODO: Fix awkard modify/manage permission checks.
can_access = is_admin or can_access_datasets[ ldda.dataset_id ]
+ can_modify = is_admin or ( cntrller in ['library', 'requests'] and can_modify_datasets[ ldda.dataset_id ])
+ can_manage = is_admin or ( cntrller in ['library', 'requests'] and can_manage_datasets[ ldda.dataset_id ])
selected = created_ldda_ids and str( ldda.id ) in created_ldda_ids
if can_access:
- render_dataset( cntrller, ldda, library_dataset, selected, library, folder, pad, my_row, row_counter, tracked_datasets, show_deleted=show_deleted )
+ render_dataset( cntrller, ldda, library_dataset, can_modify, can_manage, selected, library, folder, pad, my_row, row_counter, tracked_datasets, show_deleted=show_deleted )
%></%def>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.