Skip to content

Commit 822d5ad

Browse files
authored
Merge pull request #630 from PecanProject/develop
release 5.1.0
2 parents 23859dd + 7e6c58a commit 822d5ad

File tree

11 files changed

+124
-75
lines changed

11 files changed

+124
-75
lines changed

.zenodo.json

Lines changed: 62 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,67 @@
11
{
2-
"metadata": {
3-
"access_right": "open",
4-
"creators": [{
5-
"affiliation": "University of Illinois",
6-
"name": "Scott Rohde"
7-
},
8-
{
9-
"name": "Carl Crott"
10-
},
11-
{
12-
"affiliation": "University of Illinois",
13-
"name": "David LeBauer"
14-
},
15-
{
16-
"name": "Patrick Mulrooney"
17-
},
18-
{
19-
"affiliation": "National Center for Supercomputing Applications",
20-
"name": "Rob Kooper"
21-
},
22-
{
23-
"name": "Jeremy Kemball"
24-
},
25-
{
26-
"name": "Jimmy Chen"
27-
},
28-
{
29-
"name": "Andrew Shirk"
30-
},
31-
{
32-
"name": "Zhengqi Yang"
33-
},
34-
{
35-
"affiliation": "National Center for Supercomputing Applications",
36-
"name": "Max Burnette"
37-
},
38-
{
39-
"name": "Haotian Jiang"
40-
},
41-
{
42-
"name": "Yilin Dong"
43-
},
44-
{
45-
"name": "Uday Saraf"
46-
},
47-
{
48-
"affiliation": "Boston University",
49-
"name": "Michael Dietze"
50-
},
51-
{
52-
"name": "Chris Black"
53-
}
54-
],
55-
"language": "eng",
56-
"license": {
57-
"id": "NCSA"
2+
"access_right": "open",
3+
"creators": [{
4+
"affiliation": "University of Illinois",
5+
"name": "Scott Rohde"
586
},
59-
"references": [
60-
"LeBauer, D., Kooper, R., Mulrooney, P., Rohde, S., Wang, D., Long, S. P., & Dietze, M. C. (2018). BETYdb: a yield, trait, and ecosystem service database applied to second\u2010generation bioenergy feedstock production. GCB Bioenergy, 10(1), 61-71",
61-
"LeBauer, David, Michael Dietze, Rob Kooper, Steven Long, Patrick Mulrooney, Gareth Scott Rohde, Dan Wang (2010). Biofuel Ecophysiological Traits and Yields Database (BETYdb), Energy Biosciences Institute, University of Illinois at Urbana-Champaign. doi:10.13012/J8H41PB9"
62-
],
63-
"notes": "Development of BETYdb is supported by the National Science Foundation (ABI #1062547, ABI #1458021), the Department of Energy (ARPA-E awards #DE-AR0000594 and DE-AR0000598), and the Energy Biosciences Institute.",
64-
"resource_type": {
65-
"title": "Software",
66-
"type": "software"
7+
{
8+
"name": "Carl Crott"
9+
},
10+
{
11+
"affiliation": "University of Arizona",
12+
"name": "David LeBauer"
13+
},
14+
{
15+
"name": "Patrick Mulrooney"
16+
},
17+
{
18+
"affiliation": "National Center for Supercomputing Applications",
19+
"name": "Rob Kooper"
20+
},
21+
{
22+
"name": "Jeremy Kemball"
23+
},
24+
{
25+
"name": "Jimmy Chen"
26+
},
27+
{
28+
"name": "Andrew Shirk"
29+
},
30+
{
31+
"name": "Zhengqi Yang"
32+
},
33+
{
34+
"affiliation": "National Center for Supercomputing Applications",
35+
"name": "Max Burnette"
36+
},
37+
{
38+
"name": "Haotian Jiang"
39+
},
40+
{
41+
"name": "Yilin Dong"
42+
},
43+
{
44+
"name": "Uday Saraf"
45+
},
46+
{
47+
"affiliation": "Boston University",
48+
"name": "Michael Dietze"
49+
},
50+
{
51+
"name": "Chris Black"
6752
}
53+
],
54+
"language": "eng",
55+
"license": {
56+
"id": "NCSA"
57+
},
58+
"references": [
59+
"LeBauer, D., Kooper, R., Mulrooney, P., Rohde, S., Wang, D., Long, S. P., & Dietze, M. C. (2018). BETYdb: a yield, trait, and ecosystem service database applied to second\u2010generation bioenergy feedstock production. GCB Bioenergy, 10(1), 61-71",
60+
"LeBauer, David, Michael Dietze, Rob Kooper, Steven Long, Patrick Mulrooney, Gareth Scott Rohde, Dan Wang (2010). Biofuel Ecophysiological Traits and Yields Database (BETYdb), Energy Biosciences Institute, University of Illinois at Urbana-Champaign. doi:10.13012/J8H41PB9"
61+
],
62+
"notes": "Development of BETYdb is supported by the National Science Foundation (ABI #1062547, ABI #1458021), the Department of Energy (ARPA-E awards #DE-AR0000594 and DE-AR0000598), and the Energy Biosciences Institute.",
63+
"resource_type": {
64+
"title": "Software",
65+
"type": "software"
6866
}
6967
}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ section for the next release.
55

66
For more information about this file see also [Keep a Changelog](http://keepachangelog.com/) .
77

8+
## [5.1.0] - 2019-01-14
9+
10+
### Fixes
11+
12+
- #611 : could not close alerts
13+
- #585 : Pressing "Show" on the Covariates Edit page attempts an update
14+
- #621 : A fix for a critical vulnerability reported by Danny Rosseau at Carve Systems (www.carvesystems.com).
15+
- #596 : Crop Model Maps links are broken
16+
- #605 : Allow for keyless API access (using guestuser access)
17+
- #618 : Can not download results of search as csv
818

919
## [5.0.5] - 2018-10-23
1020

app/assets/javascripts/application.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
// defines showHide
1818
//= require min
1919

20+
// enables close button in "alert" divs:
21+
//= require script
22+
2023
//= require lazy/simple_search
2124
//= require lazy/application

app/controllers/covariates_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ def index
3131
def show
3232
@covariate = Covariate.find(params[:id])
3333

34+
if @covariate.trait.nil?
35+
flash[:error] = 'This covariate is not associated with a trait! Consider removing it.'
36+
end
37+
3438
respond_to do |format|
3539
format.html # show.html.erb
3640
format.xml { render :xml => @covariate }

app/controllers/search_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def index
155155
end
156156

157157
str = header + @results.to_comma
158-
send_data str, type: Mime::CSV,
158+
send_data str, type: :csv,
159159
disposition: "attachment; filename=search_results.csv"
160160
end
161161
format.json { render :json => @results }

app/models/bulk_upload_data_set.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,8 +1242,12 @@ def insert_data
12421242
t.site_id = row['site_id']
12431243

12441244
# Modify each Trait class instance so that date strings are
1245-
# interpreted as being in the time zone of the trait site
1246-
# (or UTC, if the trait site time_zone column is null)
1245+
# interpreted as being in the time zone of the trait site (or UTC, if
1246+
# the trait site time_zone column is null). Note that in the Bulk
1247+
# Upload Wizard, the validation step will prevent reaching this code
1248+
# if a site without time zone is in the data file. But nothing
1249+
# prevents a site without time zone from being specified
1250+
# interactively.
12471251
class <<t
12481252
def date=(value)
12491253
date = Time.use_zone(Site.find(site_id).time_zone || 'UTC') do
@@ -1971,8 +1975,8 @@ def get_insertion_data
19711975
# dates are assumed always to be accurate to the day:
19721976
csv_row_as_hash["dateloc"] = 5
19731977

1974-
# bulk upload doesn't handles "date only" dates and dates with time to the
1975-
# second; determine which:
1978+
# bulk upload handles "date only" dates and dates with time to the
1979+
# second and no other cases; determine which:
19761980
if csv_row_as_hash["date"].length == 19
19771981
csv_row_as_hash["timeloc"] = 1
19781982
elsif csv_row_as_hash["date"].length == 10

app/models/db_file.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ def setup(user_id, upload, args = nil)
3232
self[:created_user_id] = user_id
3333
self[:updated_user_id] = user_id
3434
if upload # Uploaded file
35+
# check to see it is a valid filename
36+
if upload.original_filename.match(/^[a-zA-Z0-9._\-]+$/).nil?
37+
raise("Invalid filename \"#{upload.original_filename}\"; filenames can only contain letters, numbers, periods, underscores, and dashes.")
38+
end
39+
3540
self[:file_name] = upload.original_filename
3641
self[:md5] = Digest::MD5.file(upload.path).hexdigest
3742

app/services/api_authentication_system.rb

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
# coding: utf-8
12
module ApiAuthenticationSystem
23
include AuthenticatedSystem
34

45
# Override default access_denied action.
56
def access_denied
6-
@errors = "authentication failed"
7+
if @errors
8+
@errors = "authentication failed: " + @errors
9+
else
10+
@errors = "authentication failed"
11+
end
712
render status: 401
813
end
914

@@ -19,4 +24,23 @@ def permissions(action_name, resource)
1924
end
2025
end
2126

27+
# Override "login_from_api_key" so that if no key is given or the given key is
28+
# invalid, the user is logged in as the guest user.
29+
def login_from_api_key
30+
key = params[:key]
31+
if key.nil?
32+
u = User.find_by_login('guestuser')
33+
if u.nil?
34+
@errors = "For key-less access to the API, you must set up the guest user account."
35+
end
36+
else
37+
u = User.find_by_apikey(key)
38+
if u.nil?
39+
@errors = "Invalid API key. To access the API as a guest user, omit the “key” parameter."
40+
end
41+
end
42+
43+
return u
44+
end
45+
2246
end

app/views/covariates/edit.html.erb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,14 @@
4444
<%= f.label :statname %><br />
4545
<%= f.select :statname, $statname_list %>
4646
</p>
47-
<p>
48-
<%= f.submit 'Update' %>
49-
</p>
5047

5148
<div class="form-actions">
5249
<div class="button-group">
5350
<%= link_to( covariates_path ) do %>
54-
<button class="button"><i class="icon-arrow-left"></i> All Records</button>
51+
<button class="button" type="button"><i class="icon-arrow-left"></i> All Records</button>
5552
<% end %>
5653
<%= link_to( @covariate ) do %>
57-
<button class="button">Show</button>
54+
<button class="button" type="button">Show</button>
5855
<% end %>
5956
</div>
6057
<div class="button-group pull-right">

app/views/covariates/show.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<dd><%= @covariate.stat %></dd>
1919
<dt>Statname:</dt>
2020
<dd><%= @covariate.statname %></dd>
21+
<% if @covariate.trait %>
2122
<dt>Associated Trait:</dt>
2223
<dd>
2324
<%= link_to_if @covariate.trait, @covariate.trait, @covariate.trait %>
@@ -32,6 +33,7 @@
3233
<dd><%= link_to_if @covariate.trait.specie, @covariate.trait.specie, @covariate.trait.specie %></dd>
3334
<dt>Citation:</dt>
3435
<dd><%= link_to_if @covariate.trait.citation, @covariate.trait.citation, @covariate.trait.citation %></dd>
36+
<% end %>
3537
</dl>
3638

3739

config/initializers/assets.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
lazy/feedback.js
1818
lazy/autocomplete.js
1919
lazy/bulk_upload.js
20+
21+
mylibs/maps.js
2022
)
2123

2224
Rails.application.config.assets.paths <<

0 commit comments

Comments
 (0)