details: http://www.bx.psu.edu/hg/galaxy/rev/4e0671e6eeaa changeset: 2497:4e0671e6eeaa user: Greg Von Kuster <greg@bx.psu.edu> date: Fri Jul 24 11:22:31 2009 -0400 description: Remove restriction for displaying a dataset at UCSC if the dataset is not public - as long as you can access the dataset, you can send it outside of the Galaxy environment. Fix for sharing restricted histories - default the options for sharing, and some style fixes on a few library forms. 9 file(s) affected in this change: lib/galaxy/datatypes/data.py lib/galaxy/web/controllers/history.py templates/admin/library/ldda_edit_info.mako templates/admin/library/new_dataset.mako templates/admin/library/new_folder.mako templates/history/share.mako templates/library/ldda_edit_info.mako templates/library/new_dataset.mako templates/library/new_folder.mako diffs (215 lines): diff -r 26b69d176146 -r 4e0671e6eeaa lib/galaxy/datatypes/data.py --- a/lib/galaxy/datatypes/data.py Thu Jul 23 17:08:21 2009 -0400 +++ b/lib/galaxy/datatypes/data.py Fri Jul 24 11:22:31 2009 -0400 @@ -205,16 +205,17 @@ return "This display type (%s) is not implemented for this datatype (%s)." % ( type, dataset.ext) def get_display_links(self, dataset, type, app, base_url, **kwd): """ - Returns a list of tuples of (name, link) for a particular display type - as long as the dataset is not associated with a role restricting its access. - We determine this by sending None as the user to the allow_action method. + Returns a list of tuples of (name, link) for a particular display type. No check on + 'access' permissions is done here - if you can view the dataset, you can also save it + or send it to a destination outside of Galaxy, so Galaxy security restrictions do not + apply anyway. """ - if app.security_agent.allow_action( None, dataset.permitted_actions.DATASET_ACCESS, dataset=dataset ): - try: - if type in self.get_display_types(): - return getattr (self, self.supported_display_apps[type]['links_function']) (dataset, type, app, base_url, **kwd) - except: - log.exception('Function %s is referred to in datatype %s for generating links for type %s, but is not accessible' % (self.supported_display_apps[type]['links_function'], self.__class__.__name__, type) ) + try: + if type in self.get_display_types(): + return getattr (self, self.supported_display_apps[type]['links_function']) (dataset, type, app, base_url, **kwd) + except: + log.exception( 'Function %s is referred to in datatype %s for generating links for type %s, but is not accessible' \ + % ( self.supported_display_apps[type]['links_function'], self.__class__.__name__, type ) ) return [] def get_converter_types(self, original_dataset, datatypes_registry): """Returns available converters by type for this dataset""" diff -r 26b69d176146 -r 4e0671e6eeaa lib/galaxy/web/controllers/history.py --- a/lib/galaxy/web/controllers/history.py Thu Jul 23 17:08:21 2009 -0400 +++ b/lib/galaxy/web/controllers/history.py Fri Jul 24 11:22:31 2009 -0400 @@ -288,12 +288,16 @@ # in the cloned history params = util.Params( kwd ) user = trans.get_user() + # TODO: we have too many error messages floating around in here - we need + # to incorporate the messaging system used by the libraries that will display + # a message on any page. + err_msg = util.restore_text( params.get( 'err_msg', '' ) ) if not email: if not id: # Default to the current history id = trans.security.encode_id( trans.history.id ) id = util.listify( id ) - send_to_err = "" + send_to_err = err_msg histories = [] for history_id in id: histories.append( get_history( trans, history_id ) ) @@ -304,7 +308,7 @@ histories, send_to_users, send_to_err = self._get_histories_and_users( trans, user, id, email ) if not send_to_users: if not send_to_err: - send_to_err += "%s is not a valid Galaxy user. " % email + send_to_err += "%s is not a valid Galaxy user. %s" % ( email, err_msg ) return trans.fill_template( "/history/share.mako", histories=histories, email=email, @@ -313,6 +317,7 @@ # The user has not yet made a choice about how to share, so dictionaries will be built for display can_change, cannot_change, no_change_needed, unique_no_change_needed, send_to_err = \ self._populate_restricted( trans, user, histories, send_to_users, None, send_to_err, unique=True ) + send_to_err += err_msg if can_change or cannot_change: return trans.fill_template( "/history/share.mako", histories=histories, @@ -330,7 +335,16 @@ @web.expose @web.require_login( "share restricted histories with other users" ) def share_restricted( self, trans, id=None, email="", **kwd ): - action = kwd[ 'action' ] + if 'action' in kwd: + action = kwd[ 'action' ] + else: + err_msg = "Select an action. " + return trans.response.send_redirect( url_for( controller='history', + action='share', + id=id, + email=email, + err_msg=err_msg, + share_button=True ) ) if action == "no_share": trans.response.send_redirect( url_for( controller='root', action='history_options' ) ) user = trans.get_user() diff -r 26b69d176146 -r 4e0671e6eeaa templates/admin/library/ldda_edit_info.mako --- a/templates/admin/library/ldda_edit_info.mako Thu Jul 23 17:08:21 2009 -0400 +++ b/templates/admin/library/ldda_edit_info.mako Fri Jul 24 11:22:31 2009 -0400 @@ -83,12 +83,14 @@ </div> </form> <form name="auto_detect" action="${h.url_for( controller='admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, edit_info=True )}" method="post"> - <input type="hidden" name="id" value="${ldda.id}"/> - <div style="float: left; width: 250px; margin-right: 10px;"> - <input type="submit" name="detect" value="Auto-detect"/> - </div> - <div class="toolParamHelp" style="clear: both;"> - This will inspect the dataset and attempt to correct the above column values if they are not accurate. + <div class="form-row"> + <input type="hidden" name="id" value="${ldda.id}"/> + <div style="float: left; width: 250px; margin-right: 10px;"> + <input type="submit" name="detect" value="Auto-detect"/> + </div> + <div class="toolParamHelp" style="clear: both;"> + This will inspect the dataset and attempt to correct the above column values if they are not accurate. + </div> </div> </form> </div> diff -r 26b69d176146 -r 4e0671e6eeaa templates/admin/library/new_dataset.mako --- a/templates/admin/library/new_dataset.mako Thu Jul 23 17:08:21 2009 -0400 +++ b/templates/admin/library/new_dataset.mako Fri Jul 24 11:22:31 2009 -0400 @@ -192,7 +192,9 @@ <input name="hda_ids" value="${hda.id}" type="checkbox"/>${hda.hid}: ${hda.name} </div> %endfor - <input type="submit" name="add_history_datasets_to_library_button" value="Import to library"/> + <div class="form-row"> + <input type="submit" name="add_history_datasets_to_library_button" value="Import to library"/> + </div> </form> %else: <p/> diff -r 26b69d176146 -r 4e0671e6eeaa templates/admin/library/new_folder.mako --- a/templates/admin/library/new_folder.mako Thu Jul 23 17:08:21 2009 -0400 +++ b/templates/admin/library/new_folder.mako Fri Jul 24 11:22:31 2009 -0400 @@ -36,7 +36,9 @@ </div> <div style="clear: both"></div> </div> - <input type="submit" name="new_folder_button" value="Create"/> + <div class="form-row"> + <input type="submit" name="new_folder_button" value="Create"/> + </div> </form> </div> </div> diff -r 26b69d176146 -r 4e0671e6eeaa templates/history/share.mako --- a/templates/history/share.mako Thu Jul 23 17:08:21 2009 -0400 +++ b/templates/history/share.mako Fri Jul 24 11:22:31 2009 -0400 @@ -58,6 +58,12 @@ %else: ## We are sharing restricted histories <form name='share_restricted' id=share_restricted' action="${h.url_for( controller='history', action='share_restricted' )}" method="post"> + %if send_to_err: + <div style="clear: both"></div> + <div class="form-row"> + <div class="errormessage">${send_to_err}</div> + </div> + %endif ## Needed for rebuilding dicts <input type="hidden" name="email" value="${email}" size="40"> %for history in histories: @@ -173,7 +179,7 @@ %endif </div> <div class="form-row"> - <input type="radio" name="action" value="no_share"> Don't share + <input type="radio" name="action" value="no_share" checked> Don't share </div> <div class="form-row"> <input type="submit" name="share_restricted_button" value="Go"><br/> diff -r 26b69d176146 -r 4e0671e6eeaa templates/library/ldda_edit_info.mako --- a/templates/library/ldda_edit_info.mako Thu Jul 23 17:08:21 2009 -0400 +++ b/templates/library/ldda_edit_info.mako Fri Jul 24 11:22:31 2009 -0400 @@ -83,12 +83,14 @@ </div> </form> <form name="auto_detect" action="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, edit_info=True )}" method="post"> - <input type="hidden" name="id" value="${ldda.id}"/> - <div style="float: left; width: 250px; margin-right: 10px;"> - <input type="submit" name="detect" value="Auto-detect"/> - </div> - <div class="toolParamHelp" style="clear: both;"> - This will inspect the dataset and attempt to correct the above column values if they are not accurate. + <div class="form-row"> + <input type="hidden" name="id" value="${ldda.id}"/> + <div style="float: left; width: 250px; margin-right: 10px;"> + <input type="submit" name="detect" value="Auto-detect"/> + </div> + <div class="toolParamHelp" style="clear: both;"> + This will inspect the dataset and attempt to correct the above column values if they are not accurate. + </div> </div> </form> </div> diff -r 26b69d176146 -r 4e0671e6eeaa templates/library/new_dataset.mako --- a/templates/library/new_dataset.mako Thu Jul 23 17:08:21 2009 -0400 +++ b/templates/library/new_dataset.mako Fri Jul 24 11:22:31 2009 -0400 @@ -201,7 +201,9 @@ <input name="hda_ids" value="${hda.id}" type="checkbox"/>${hda.hid}: ${hda.name} </div> %endfor - <input type="submit" name="add_history_datasets_to_library_button" value="Import to library"/> + <div class="form-row"> + <input type="submit" name="add_history_datasets_to_library_button" value="Import to library"/> + </div> </form> %else: <p/> diff -r 26b69d176146 -r 4e0671e6eeaa templates/library/new_folder.mako --- a/templates/library/new_folder.mako Thu Jul 23 17:08:21 2009 -0400 +++ b/templates/library/new_folder.mako Fri Jul 24 11:22:31 2009 -0400 @@ -36,7 +36,9 @@ </div> <div style="clear: both"></div> </div> - <input type="submit" name="new_folder_button" value="Create"/> + <div class="form-row"> + <input type="submit" name="new_folder_button" value="Create"/> + </div> </form> </div> </div>