[hg] galaxy 3255: Require that users set a public username befor...
details: http://www.bx.psu.edu/hg/galaxy/rev/ea652508497a changeset: 3255:ea652508497a user: jeremy goecks <jeremy.goecks@emory.edu> date: Fri Jan 22 08:47:05 2010 -0500 description: Require that users set a public username before making items accessible via link or publishing. diffstat: lib/galaxy/web/base/controller.py | 9 ++ lib/galaxy/web/controllers/history.py | 2 +- templates/sharing_base.mako | 124 +++++++++++++++++++-------------- 3 files changed, 81 insertions(+), 54 deletions(-) diffs (170 lines): diff -r 4dfbf68c8c7e -r ea652508497a lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py Wed Jan 20 13:19:05 2010 -0500 +++ b/lib/galaxy/web/base/controller.py Fri Jan 22 08:47:05 2010 -0500 @@ -115,6 +115,15 @@ class Sharable: """ Mixin for a controller that manages and item that can be shared. """ + + # Implemented methods. + @web.expose + @web.require_login( "share Galaxy items" ) + def set_public_username( self, trans, id, username, **kwargs ): + """ Set user's public username and delegate to sharing() """ + trans.get_user().username = username + trans.sa_session.flush + return self.sharing( trans, id, **kwargs ) # Abstract methods. diff -r 4dfbf68c8c7e -r ea652508497a lib/galaxy/web/controllers/history.py --- a/lib/galaxy/web/controllers/history.py Wed Jan 20 13:19:05 2010 -0500 +++ b/lib/galaxy/web/controllers/history.py Fri Jan 22 08:47:05 2010 -0500 @@ -542,7 +542,7 @@ elif 'unpublish' in kwargs: history.published = False elif 'disable_link_access_and_unpubish' in kwargs: - history.importable = stored.published = False + history.importable = history.published = False elif 'unshare_user' in kwargs: user = trans.sa_session.query( trans.app.model.User ).get( trans.security.decode_id( kwargs[ 'unshare_user' ] ) ) if not user: diff -r 4dfbf68c8c7e -r ea652508497a templates/sharing_base.mako --- a/templates/sharing_base.mako Wed Jan 20 13:19:05 2010 -0500 +++ b/templates/sharing_base.mako Fri Jan 22 08:47:05 2010 -0500 @@ -71,64 +71,82 @@ <h3>Making ${item_class_name} Accessible via Link and Publishing It</h3> <div class="indent"> - %if item.importable: - <% - item_status = "accessible via link" - if item.published: - item_status = item_status + " and published" - %> - This ${item_class_name_lc} <strong>${item_status}</strong>. - <div class="indent"> - <p>Anyone can view and import this ${item_class_name_lc} by visiting the following URL: - <% url = h.url_for( action='display_by_username_and_slug', username=trans.get_user().username, slug=item.slug, qualified=True ) %> - <blockquote> - <a href="${url}" target="_top">${url}</a> - </blockquote> + %if trans.get_user().username is None or trans.get_user().username is "": + To make a ${item_class_name_lc} accessible via link or publish it, you must create a public username: + <p> + <form action="${h.url_for( action='set_public_username', id=trans.security.encode_id( item.id ) )}" + method="POST"> + <div class="form-row"> + <label>Public Username:</label> + <div class="form-row-input"> + <input type="text" name="username" size="40"/> + </div> + </div> + <div style="clear: both"></div> + <div class="form-row"> + <input class="action-button" type="submit" name="Set Username" value="Set Username"/> + </div> + </form> + %else: + %if item.importable: + <% + item_status = "accessible via link" + if item.published: + item_status = item_status + " and published" + %> + This ${item_class_name_lc} <strong>${item_status}</strong>. + <div class="indent"> + <p>Anyone can view and import this ${item_class_name_lc} by visiting the following URL: + <% url = h.url_for( action='display_by_username_and_slug', username=trans.get_user().username, slug=item.slug, qualified=True ) %> + <blockquote> + <a href="${url}" target="_top">${url}</a> + </blockquote> - %if item.published: - This ${item_class_name_lc} is publicly listed and searchable in Galaxy's <a href='${h.url_for( action='list_published' )}' target="_top">Published ${item_class_plural_name}</a> section. - %endif - </div> + %if item.published: + This ${item_class_name_lc} is publicly listed and searchable in Galaxy's <a href='${h.url_for( action='list_published' )}' target="_top">Published ${item_class_plural_name}</a> section. + %endif + </div> - <p>You can: - <div class="indent"> - <form action="${h.url_for( action='sharing', id=trans.security.encode_id( item.id ) )}" - method="POST"> - %if not item.published: - ## Item is importable but not published. User can disable importable or publish. - <input class="action-button" type="submit" name="disable_link_access" value="Disable Access to ${item_class_name} Link"> - <div class="toolParamHelp">Disables ${item_class_name_lc}'s link so that it is not accessible.</div> + <p>You can: + <div class="indent"> + <form action="${h.url_for( action='sharing', id=trans.security.encode_id( item.id ) )}" + method="POST"> + %if not item.published: + ## Item is importable but not published. User can disable importable or publish. + <input class="action-button" type="submit" name="disable_link_access" value="Disable Access to ${item_class_name} Link"> + <div class="toolParamHelp">Disables ${item_class_name_lc}'s link so that it is not accessible.</div> + <br> + <input class="action-button" type="submit" name="publish" value="Publish ${item_class_name}" method="POST"> + <div class="toolParamHelp">Publishes the ${item_class_name_lc} to Galaxy's <a href='${h.url_for( action='list_published' )}' target="_top">Published ${item_class_plural_name}</a> section, where it is publicly listed and searchable.</div> + <br> - <input class="action-button" type="submit" name="publish" value="Publish ${item_class_name}" method="POST"> - <div class="toolParamHelp">Publishes the ${item_class_name_lc} to Galaxy's <a href='${h.url_for( action='list_published' )}' target="_top">Published ${item_class_plural_name}</a> section, where it is publicly listed and searchable.</div> - + %else: ## item.published == True + ## Item is importable and published. User can unpublish or disable import and unpublish. + <input class="action-button" type="submit" name="unpublish" value="Unpublish ${item_class_name}"> + <div class="toolParamHelp">Removes ${item_class_name_lc} from Galaxy's <a href='${h.url_for( action='list_published' )}' target="_top">Published ${item_class_plural_name}</a> section so that it is not publicly listed or searchable.</div> + <br> + <input class="action-button" type="submit" name="disable_link_access_and_unpubish" value="Disable Access to ${item_class_name} via Link and Unpublish"> + <div class="toolParamHelp">Disables ${item_class_name_lc}'s link so that it is not accessible and removes ${item_class_name_lc} from Galaxy's <a href='${h.url_for( action='list_published' )}' target='_top'>Published ${item_class_plural_name}</a> section so that it is not publicly listed or searchable.</div> + %endif + + </form> + </div> + + %else: + + This ${item_class_name_lc} is currently restricted so that only you and the users listed below can access it. You can: + <p> + <form action="${h.url_for( action='sharing', id=trans.security.encode_id(item.id) )}" method="POST"> + <input class="action-button" type="submit" name="make_accessible_via_link" value="Make ${item_class_name} Accessible via Link"> + <div class="toolParamHelp">Generates a web link that you can share with other people so that they can view and import the ${item_class_name_lc}.</div> + <br> - %else: ## item.published == True - ## Item is importable and published. User can unpublish or disable import and unpublish. - <input class="action-button" type="submit" name="unpublish" value="Unpublish ${item_class_name}"> - <div class="toolParamHelp">Removes ${item_class_name_lc} from Galaxy's <a href='${h.url_for( action='list_published' )}' target="_top">Published ${item_class_plural_name}</a> section so that it is not publicly listed or searchable.</div> - <br> - <input class="action-button" type="submit" name="disable_link_access_and_unpubish" value="Disable Access to ${item_class_name} via Link and Unpublish"> - <div class="toolParamHelp">Disables ${item_class_name_lc}'s link so that it is not accessible and removes ${item_class_name_lc} from Galaxy's <a href='${h.url_for( action='list_published' )}' target='_top'>Published ${item_class_plural_name}</a> section so that it is not publicly listed or searchable.</div> - %endif - - </form> - </div> - - %else: - - This ${item_class_name_lc} is currently restricted so that only you and the users listed below can access it. You can: - <p> - <form action="${h.url_for( action='sharing', id=trans.security.encode_id(item.id) )}" method="POST"> - <input class="action-button" type="submit" name="make_accessible_via_link" value="Make ${item_class_name} Accessible via Link"> - <div class="toolParamHelp">Generates a web link that you can share with other people so that they can view and import the ${item_class_name_lc}.</div> - - <br> - <input class="action-button" type="submit" name="make_accessible_and_publish" value="Make ${item_class_name} Accessible and Publish" method="POST"> - <div class="toolParamHelp">Makes the ${item_class_name_lc} accessible via link (see above) and publishes the ${item_class_name_lc} to Galaxy's <a href='${h.url_for( action='list_published' )}' target='_top'>Published ${item_class_plural_name}</a> section, where it is publicly listed and searchable.</div> - </form> + <input class="action-button" type="submit" name="make_accessible_and_publish" value="Make ${item_class_name} Accessible and Publish" method="POST"> + <div class="toolParamHelp">Makes the ${item_class_name_lc} accessible via link (see above) and publishes the ${item_class_name_lc} to Galaxy's <a href='${h.url_for( action='list_published' )}' target='_top'>Published ${item_class_plural_name}</a> section, where it is publicly listed and searchable.</div> + </form> - %endif + %endif + %endif </div> <h3>Sharing ${item_class_name} with Specific Users</h3>
participants (1)
-
Greg Von Kuster