diff --git a/.ruby-version b/.ruby-version index a9eea9a34..d7edb5686 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.3.8 +ruby-2.6.5 diff --git a/CHANGELOG.md b/CHANGELOG.md index 62eafbce6..38b542d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog Fab-manager +## v4.4.2 2020 May 19 + +- Upgraded to ruby 2.6.5 +- Prevent admins from leaving their dedicated group +- Faraday was downgraded from 1.0 to 0.17 for better compatibility with elasticsearch-ruby 5 (#205 #196) +- Added [an option](doc/environment.md#ALLOW_INSECURE_HTTP) to allow usage in production without HTTPS +- Now using node.js instead of therubyracer for building javascript assets +- Removed dependency to has_secure_token to fix warnings about already initialized constant +- Fix a bug: when an admin logs on the subscription page, his view is broken +- Fix a bug: admin's members list shows the same members multiple times +- Fix a bug: when a new account is created through the sign-up modal, the role is not reported in the StatisticProfile (#196) +- Fix a bug: openAPI clients interface has a bugged behavior when creating/editing a client +- Fix a security issue: updated actionpack-page_caching from 1.1.0 to 1.2.2 to fix [CVE-2020-8159](https://nvd.nist.gov/vuln/detail/CVE-2020-8159) +- [TODO DEPLOY] `rails fablab:fix:role_in_statistic_profile` +- [TODO DEPLOY] `rails fablab:es:generate_stats[2019-06-13]` (run after the command above!) +- [TODO DEPLOY] -> (only dev) `rvm use && bundle install` + ## v4.4.1 2020 May 12 - Prevent VersionCheckWorker from polluting the sidekiq stack in development diff --git a/Dockerfile b/Dockerfile index 04e5c8428..b93014ac6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.3.8-alpine +FROM ruby:2.6.5-alpine MAINTAINER peng@sleede.com # Install upgrade system packages @@ -28,6 +28,8 @@ RUN apk update && apk upgrade && \ git \ patch +RUN gem install bundler + # Throw error if Gemfile has been modified since Gemfile.lock RUN bundle config --global frozen 1 diff --git a/Gemfile b/Gemfile index dfe35d9bd..6c091f384 100644 --- a/Gemfile +++ b/Gemfile @@ -18,8 +18,6 @@ gem 'sass-rails', '~> 5.0', '>= 5.0.6' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 4.1.20' -# See https://github.com/sstephenson/execjs#readme for more supported runtimes -gem 'therubyracer', '= 0.12.0', platforms: :ruby # Use jquery as the JavaScript library gem 'jquery-rails' @@ -115,6 +113,7 @@ gem 'prawn-table' gem 'elasticsearch-model', '~> 5' gem 'elasticsearch-persistence', '~> 5' gem 'elasticsearch-rails', '~> 5' +gem 'faraday', '~> 0.17' gem 'notify_with' @@ -122,7 +121,7 @@ gem 'pundit' gem 'oj' -gem 'actionpack-page_caching', '1.1.0' +gem 'actionpack-page_caching', '1.2.2' gem 'rails-observers' gem 'chroma' @@ -133,7 +132,6 @@ gem 'openlab_ruby' gem 'api-pagination' gem 'apipie-rails' -gem 'has_secure_token' # XLS files generation gem 'caxlsx' diff --git a/Gemfile.lock b/Gemfile.lock index 5513821f6..f6cbe0f62 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,8 +39,8 @@ GEM rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionpack-page_caching (1.1.0) - actionpack (>= 4.0.0, < 6) + actionpack-page_caching (1.2.2) + actionpack (>= 5.0.0) actionview (5.2.4.2) activesupport (= 5.2.4.2) builder (~> 3.1) @@ -165,7 +165,7 @@ GEM execjs (2.7.0) faker (2.10.2) i18n (>= 1.6, < 2) - faraday (1.0.0) + faraday (0.17.3) multipart-post (>= 1.2, < 3) ffi (1.12.2) font-awesome-rails (4.7.0.5) @@ -179,8 +179,6 @@ GEM raabro (~> 1.1) globalid (0.4.2) activesupport (>= 4.2.0) - has_secure_token (1.0.0) - activerecord (>= 3.0) hashdiff (1.0.1) hashery (2.1.2) hashie (4.1.0) @@ -217,11 +215,10 @@ GEM activerecord kaminari-core (= 1.2.0) kaminari-core (1.2.0) - libv8 (3.16.14.19) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - loofah (2.4.0) + loofah (2.5.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -348,7 +345,6 @@ GEM redis (4.1.3) redis-namespace (1.6.0) redis (>= 3.0.4) - ref (2.0.0) repost (0.3.2) responders (2.4.1) actionpack (>= 4.2.0, < 6.0) @@ -419,9 +415,6 @@ GEM ffi term-ansicolor (1.7.1) tins (~> 1.0) - therubyracer (0.12.0) - libv8 (~> 3.16.14.0) - ref thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) @@ -432,7 +425,7 @@ GEM camertron-eprun cldr-plurals-runtime-rb (~> 1.0) tzinfo - tzinfo (1.2.6) + tzinfo (1.2.7) thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) @@ -463,7 +456,7 @@ PLATFORMS DEPENDENCIES aasm - actionpack-page_caching (= 1.1.0) + actionpack-page_caching (= 1.2.2) active_record_query_trace api-pagination apipie-rails @@ -484,11 +477,11 @@ DEPENDENCIES elasticsearch-persistence (~> 5) elasticsearch-rails (~> 5) faker + faraday (~> 0.17) font-awesome-rails foreman forgery friendly_id (~> 5.1.0) - has_secure_token icalendar jbuilder (~> 2.5) jbuilder_cache_multi @@ -533,11 +526,10 @@ DEPENDENCIES spring-watcher-listen (~> 2.0.0) stripe (= 5.1.1) sys-filesystem - therubyracer (= 0.12.0) uglifier (>= 4.1.20) vcr (= 3.0.1) web-console (>= 3.3.0) webmock BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/README.md b/README.md index 01a4d8e53..29fb01742 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ Before reporting an issue, please check if your issue is not listed in the [know ## Related Documentation -- [Ruby 2.3.0](http://ruby-doc.org/core-2.3.0/) +- [Ruby 2.6.5](http://ruby-doc.org/core-2.6.5/) - [Ruby on Rails](http://api.rubyonrails.org) - [AngularJS](https://docs.angularjs.org/api) - [Angular-Bootstrap](http://angular-ui.github.io/bootstrap/) diff --git a/app/assets/javascripts/controllers/admin/open_api_clients.js b/app/assets/javascripts/controllers/admin/open_api_clients.js index 0b71944dc..17fb545ae 100644 --- a/app/assets/javascripts/controllers/admin/open_api_clients.js +++ b/app/assets/javascripts/controllers/admin/open_api_clients.js @@ -20,11 +20,18 @@ Application.Controllers.controller('OpenAPIClientsController', ['$scope', 'clien $scope.clientFormVisible = false; $scope.client = {}; - $scope.toggleForm = () => $scope.clientFormVisible = !$scope.clientFormVisible; + /** + * Show the name edition form for a new client + */ + $scope.createClient = function () { + $scope.clientFormVisible = true; + $scope.client = {}; + }; - // Change the order criterion to the one provided - // @param orderBy {string} ordering criterion - // + /** + * Change the order criterion to the one provided + * @param orderBy {string} ordering criterion + */ $scope.setOrder = function (orderBy) { if ($scope.order === orderBy) { return $scope.order = `-${orderBy}`; @@ -33,6 +40,14 @@ Application.Controllers.controller('OpenAPIClientsController', ['$scope', 'clien } }; + /** + * Reset the name ot its original value and close the edition form + */ + $scope.cancelEdit = function () { + $scope.client.name = $scope.clientOriginalName; + $scope.clientFormVisible = false; + }; + $scope.saveClient = function (client) { if (client.id != null) { OpenAPIClient.update({ id: client.id }, { open_api_client: client }, function (clientResp) { @@ -47,13 +62,13 @@ Application.Controllers.controller('OpenAPIClientsController', ['$scope', 'clien } $scope.clientFormVisible = false; - $scope.clientForm.$setPristine(); - return $scope.client = {}; + $scope.client = {}; }; $scope.editClient = function (client) { $scope.clientFormVisible = true; - return $scope.client = client; + $scope.client = client; + $scope.clientOriginalName = client.name; }; $scope.deleteClient = index => diff --git a/app/assets/javascripts/controllers/application.js.erb b/app/assets/javascripts/controllers/application.js.erb index ea478fb65..c0f67baa2 100644 --- a/app/assets/javascripts/controllers/application.js.erb +++ b/app/assets/javascripts/controllers/application.js.erb @@ -450,9 +450,9 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco return $state.go(toState, toParams); } }, function (reason) { - // authentication did not ended successfully + // authentication did not end successfully if (reason === 'signup') { - // open signup modal + // open sign-up modal $scope.signup(); } else if (reason === 'resetPassword') { // open the 'reset password' modal diff --git a/app/assets/javascripts/controllers/plans.js.erb b/app/assets/javascripts/controllers/plans.js.erb index 7f4fa4386..19fbc30cf 100644 --- a/app/assets/javascripts/controllers/plans.js.erb +++ b/app/assets/javascripts/controllers/plans.js.erb @@ -197,10 +197,10 @@ Application.Controllers.controller('PlansIndexController', ['$scope', '$rootScop } } - $scope.$on('devise:new-session', function (event, user) { $scope.ctrl.member = user; }); + $scope.$on('devise:new-session', function (event, user) { if (user.role !== 'admin') { $scope.ctrl.member = user; } }); // watch when a coupon is applied to re-compute the total price - return $scope.$watch('coupon.applied', function (newValue, oldValue) { + $scope.$watch('coupon.applied', function (newValue, oldValue) { if ((newValue !== null) || (oldValue !== null)) { return updateCartPrice(); } diff --git a/app/assets/templates/admin/open_api_clients/index.html.erb b/app/assets/templates/admin/open_api_clients/index.html.erb index 07e9764f7..73ff4df84 100644 --- a/app/assets/templates/admin/open_api_clients/index.html.erb +++ b/app/assets/templates/admin/open_api_clients/index.html.erb @@ -34,14 +34,14 @@