1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/4d593e0fafe5/ Changeset: 4d593e0fafe5 User: martenson Date: 2014-03-31 18:55:06 Summary: added is_admin to the javascript user object for UI rendering purposes; modified is_admin_user in masthead config to be consistent with standard is_admin check Affected #: 4 files
diff -r 8217bcfd4c3c8986c4a62f93f6b17dc8b3fed55a -r 4d593e0fafe501f233cfe8c67ad608bd12a37ff6 lib/galaxy/webapps/galaxy/api/users.py --- a/lib/galaxy/webapps/galaxy/api/users.py +++ b/lib/galaxy/webapps/galaxy/api/users.py @@ -81,6 +81,7 @@ #TODO: move into api_values (needs trans, tho - can we do that with api_keys/@property??) #TODO: works with other users (from admin)?? item['quota_percent'] = trans.app.quota_agent.get_percent( trans=trans ) + item['is_admin'] = trans.user_is_admin() return item
@web.expose_api
diff -r 8217bcfd4c3c8986c4a62f93f6b17dc8b3fed55a -r 4d593e0fafe501f233cfe8c67ad608bd12a37ff6 static/scripts/mvc/user/user-model.js --- a/static/scripts/mvc/user/user-model.js +++ b/static/scripts/mvc/user/user-model.js @@ -30,7 +30,8 @@ email : "", total_disk_usage : 0, nice_total_disk_usage : "", - quota_percent : null + quota_percent : null, + is_admin : false },
/** Set up and bind events @@ -47,6 +48,10 @@ return ( !this.get( 'email' ) ); },
+ isAdmin : function(){ + return ( this.get( 'is_admin' ) ); + }, + /** Load a user with the API using an id. * If getting an anonymous user or no access to a user id, pass the User.CURRENT_ID_STR * (e.g. 'current') and the API will return the current transaction's user data.
diff -r 8217bcfd4c3c8986c4a62f93f6b17dc8b3fed55a -r 4d593e0fafe501f233cfe8c67ad608bd12a37ff6 static/scripts/packed/mvc/user/user-model.js --- a/static/scripts/packed/mvc/user/user-model.js +++ b/static/scripts/packed/mvc/user/user-model.js @@ -1,1 +1,1 @@ -define(["mvc/base-mvc"],function(a){var c=Backbone.Model.extend(a.LoggableMixin).extend({urlRoot:galaxy_config.root+"api/users",defaults:{id:null,username:"("+_l("anonymous user")+")",email:"",total_disk_usage:0,nice_total_disk_usage:"",quota_percent:null},initialize:function(d){this.log("User.initialize:",d);this.on("loaded",function(e,f){this.log(this+" has loaded:",e,f)});this.on("change",function(e,f){this.log(this+" has changed:",e,f.changes)})},isAnonymous:function(){return(!this.get("email"))},loadFromApi:function(g,e){g=g||c.CURRENT_ID_STR;e=e||{};var d=this,f=e.success;e.success=function(i,h){d.trigger("loaded",i,h);if(f){f(i,h)}};if(g===c.CURRENT_ID_STR){e.url=this.urlRoot+"/"+c.CURRENT_ID_STR}return Backbone.Model.prototype.fetch.call(this,e)},clearSessionStorage:function(){for(var d in sessionStorage){if(d.indexOf("history:")===0){sessionStorage.removeItem(d)}else{if(d==="history-panel"){sessionStorage.removeItem(d)}}}},toString:function(){var d=[this.get("username")];if(this.get("id")){d.unshift(this.get("id"));d.push(this.get("email"))}return"User("+d.join(":")+")"}});c.CURRENT_ID_STR="current";c.getCurrentUserFromApi=function(e){var d=new c();d.loadFromApi(c.CURRENT_ID_STR,e);return d};var b=Backbone.Collection.extend(a.LoggableMixin).extend({model:c,urlRoot:galaxy_config.root+"api/users"});return{User:c}}); \ No newline at end of file +define(["mvc/base-mvc"],function(a){var c=Backbone.Model.extend(a.LoggableMixin).extend({urlRoot:galaxy_config.root+"api/users",defaults:{id:null,username:"("+_l("anonymous user")+")",email:"",total_disk_usage:0,nice_total_disk_usage:"",quota_percent:null,is_admin:false},initialize:function(d){this.log("User.initialize:",d);this.on("loaded",function(e,f){this.log(this+" has loaded:",e,f)});this.on("change",function(e,f){this.log(this+" has changed:",e,f.changes)})},isAnonymous:function(){return(!this.get("email"))},isAdmin:function(){return(this.get("is_admin"))},loadFromApi:function(g,e){g=g||c.CURRENT_ID_STR;e=e||{};var d=this,f=e.success;e.success=function(i,h){d.trigger("loaded",i,h);if(f){f(i,h)}};if(g===c.CURRENT_ID_STR){e.url=this.urlRoot+"/"+c.CURRENT_ID_STR}return Backbone.Model.prototype.fetch.call(this,e)},clearSessionStorage:function(){for(var d in sessionStorage){if(d.indexOf("history:")===0){sessionStorage.removeItem(d)}else{if(d==="history-panel"){sessionStorage.removeItem(d)}}}},toString:function(){var d=[this.get("username")];if(this.get("id")){d.unshift(this.get("id"));d.push(this.get("email"))}return"User("+d.join(":")+")"}});c.CURRENT_ID_STR="current";c.getCurrentUserFromApi=function(e){var d=new c();d.loadFromApi(c.CURRENT_ID_STR,e);return d};var b=Backbone.Collection.extend(a.LoggableMixin).extend({model:c,urlRoot:galaxy_config.root+"api/users"});return{User:c}}); \ No newline at end of file
diff -r 8217bcfd4c3c8986c4a62f93f6b17dc8b3fed55a -r 4d593e0fafe501f233cfe8c67ad608bd12a37ff6 templates/webapps/galaxy/galaxy.masthead.mako --- a/templates/webapps/galaxy/galaxy.masthead.mako +++ b/templates/webapps/galaxy/galaxy.masthead.mako @@ -9,6 +9,7 @@ user_dict[ 'quota_percent' ] = trans.app.quota_agent.get_percent( trans=trans ) users_api_controller = trans.webapp.api_controllers[ 'users' ] user_dict[ 'tags_used' ] = users_api_controller.get_user_tags_used( trans, user=trans.user ) + user_dict[ 'is_admin' ] = trans.user_is_admin() else: usage = 0 percent = None @@ -50,7 +51,7 @@ 'terms_url' : app.config.get("terms_url", ""), 'allow_user_creation' : app.config.allow_user_creation, 'logo_url' : h.url_for(app.config.get( 'logo_url', '/')), - 'is_admin_user' : trans.user and app.config.is_admin_user(trans.user), + 'is_admin_user' : trans.user_is_admin(), 'active_view' : active_view, 'ftp_upload_dir' : app.config.get("ftp_upload_dir", None), 'ftp_upload_site' : app.config.get("ftp_upload_site", None),
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.