Skip to content

Commit

Permalink
Merge branch 'dev' into remove_toolshed_grids
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Oct 4, 2017
2 parents fa6133e + 562465f commit e31b37e
Show file tree
Hide file tree
Showing 16 changed files with 122 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ var FolderListView = Backbone.View.extend({
'</ol>',

// FOLDER CONTENT
'<table data-library-id="<%- parent_library_id %>" id="folder_table" class="grid table table-condensed">',
'<table data-library-id="<%- parent_library_id %>" class="grid table table-condensed">',
'<thead>',
'<th class="button_heading"></th>',
'<th style="text-align: center; width: 20px; " title="Check to select all datasets"><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>',
Expand Down
14 changes: 9 additions & 5 deletions client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ var FolderToolbarView = Backbone.View.extend({

// show bulk import modal
modalBulkImport : function(){
var checkedValues = $('#folder_table').find(':checked');
if(checkedValues.length === 0){
var $checkedValues = this.findCheckedRows();
if($checkedValues.length === 0){
mod_toastr.info('You must select some datasets first.');
} else {
var that = this;
Expand Down Expand Up @@ -268,7 +268,7 @@ var FolderToolbarView = Backbone.View.extend({
processImportToHistory: function( history_id, history_name ){
var dataset_ids = [];
var folder_ids = [];
$('#folder_table').find(':checked').each(function(){
this.findCheckedRows().each(function(){
var row_id = $(this).closest('tr').data('id');
if (row_id.substring(0,1) == 'F'){
folder_ids.push(row_id);
Expand Down Expand Up @@ -323,7 +323,7 @@ var FolderToolbarView = Backbone.View.extend({
download : function( folder_id, format ){
var dataset_ids = [];
var folder_ids = [];
$( '#folder_table' ).find( ':checked' ).each( function(){
this.findCheckedRows().each( function(){
var row_id = $(this).closest('tr').data('id');
if (row_id.substring(0,1) == 'F'){
folder_ids.push(row_id);
Expand Down Expand Up @@ -997,7 +997,7 @@ var FolderToolbarView = Backbone.View.extend({
deleteSelectedItems: function(){
var dataset_ids = [];
var folder_ids = [];
var $checkedValues = $('#folder_table').find(':checked');
var $checkedValues = this.findCheckedRows();
if($checkedValues.length === 0){
mod_toastr.info('You must select at least one item for deletion.');
} else {
Expand Down Expand Up @@ -1116,6 +1116,10 @@ var FolderToolbarView = Backbone.View.extend({
}
},

findCheckedRows: function(){
return $('#folder_list_body').find(':checked');
},

templateToolBar: function(){
return _.template([
// container start
Expand Down
26 changes: 17 additions & 9 deletions client/galaxy/scripts/onload.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,21 @@ $(document).ready( function() {
}
}

// Load all webhooks with the type 'onload'
$.getJSON( Galaxy.root + 'api/webhooks/onload/all', function(webhooks) {
_.each(webhooks, function(webhook) {
if (webhook.activate && webhook.script) {
$('<script/>', {type: 'text/javascript'}).text(webhook.script).appendTo('head');
$('<style/>', {type: 'text/css'}).text(webhook.styles).appendTo('head');
}
});
});
function onloadWebhooks() {
if (Galaxy.root !== undefined){
// Load all webhooks with the type 'onload'
$.getJSON( Galaxy.root + 'api/webhooks/onload/all', function(webhooks) {
_.each(webhooks, function(webhook) {
if (webhook.activate && webhook.script) {
$('<script/>', {type: 'text/javascript'}).text(webhook.script).appendTo('head');
$('<style/>', {type: 'text/css'}).text(webhook.styles).appendTo('head');
}
});
});
}
else {
setTimeout(onloadWebhooks, 100);
}
}
onloadWebhooks();
});
2 changes: 1 addition & 1 deletion config/galaxy.ini.sample
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ use_interactive = True
# Galaxy encodes various internal values when these values will be output in
# some format (for example, in a URL or cookie). You should set a key to be
# used by the algorithm that encodes and decodes these values. It can be any
# string.
# string up to 448 bits long.
# One simple way to generate a value for this is with the shell command:
# python -c 'import time; print time.time()' | md5sum | cut -f 1 -d ' '
#id_secret = USING THE DEFAULT IS NOT SECURE!
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/dependencies/conditional-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ statsd
graphitesend
azure-storage==0.32.0
# PyRods not in PyPI
python-ldap==2.4.27
python-ldap==2.4.44

# Chronos client
chronos-python==0.38.0
Expand Down
27 changes: 23 additions & 4 deletions lib/galaxy/web/security/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
import os.path
import logging

import galaxy.exceptions

from Crypto.Cipher import Blowfish
from Crypto.Util.randpool import RandomPool
from Crypto.Util import number

import galaxy.exceptions

from galaxy.util import smart_str

log = logging.getLogger(__name__)

MAXIMUM_ID_SECRET_BITS = 448
MAXIMUM_ID_SECRET_LENGTH = MAXIMUM_ID_SECRET_BITS / 8
KIND_TOO_LONG_MESSAGE = "Galaxy coding error, keep encryption 'kinds' smaller to utilize more bites of randomness from id_secret values."


if os.path.exists("/dev/urandom"):
# We have urandom, use it as the source of random data
random_fd = os.open("/dev/urandom", os.O_RDONLY)
Expand All @@ -37,7 +44,8 @@ def get_random_bytes(nbytes):
class SecurityHelper(object):

def __init__(self, **config):
self.id_secret = config['id_secret']
id_secret = config['id_secret']
self.id_secret = id_secret
self.id_cipher = Blowfish.new(self.id_secret)

per_kind_id_secret_base = config.get('per_kind_id_secret_base', self.id_secret)
Expand Down Expand Up @@ -127,4 +135,15 @@ def __init__(self, secret_base):
self.secret_base = secret_base

def __missing__(self, key):
return Blowfish.new(self.secret_base + "__" + key)
assert len(key) < 15, KIND_TOO_LONG_MESSAGE
secret = self.secret_base + "__" + key
return Blowfish.new(_last_bits(secret))


def _last_bits(secret):
"""We append the kind at the end, so just use the bits at the end.
"""
last_bits = smart_str(secret)
if len(last_bits) > MAXIMUM_ID_SECRET_LENGTH:
last_bits = last_bits[-MAXIMUM_ID_SECRET_LENGTH:]
return last_bits
2 changes: 1 addition & 1 deletion static/maps/mvc/library/library-folderlist-view.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/maps/mvc/library/library-foldertoolbar-view.js.map

Large diffs are not rendered by default.

0 comments on commit e31b37e

Please sign in to comment.