diff --git a/Dockerfile b/Dockerfile index bbc327ce..ee764b87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,10 @@ COPY Gemfile* /srv/ontoportal/ontologies_linked_data/ WORKDIR /srv/ontoportal/ontologies_linked_data +# set rubygem and bundler to the last version supported by ruby 2.7 +# remove version after ruby v3 upgrade +RUN gem update --system '3.4.22' +RUN gem install bundler -v 2.4.22 RUN gem update --system RUN gem install bundler ENV BUNDLE_PATH=/srv/ontoportal/bundle diff --git a/Gemfile.lock b/Gemfile.lock index 4abba794..1c85b57d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/ncbo/goo.git - revision: 657149d6b33813253fa7440252f69c04e0631190 + revision: 75436fe8e387febc53e34ee31ff0e6dd837a9d3f branch: master specs: goo (0.0.2) @@ -32,12 +32,13 @@ GEM multi_json (~> 1.3) thread_safe (~> 0.1) tzinfo (~> 0.3.37) - addressable (2.8.5) + addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) ansi (1.5.0) ast (2.4.2) base64 (0.2.0) - bcrypt (3.1.19) + bcrypt (3.1.20) + bigdecimal (3.1.5) builder (3.2.4) coderay (1.1.3) concurrent-ruby (1.2.2) @@ -46,14 +47,13 @@ GEM daemons (1.4.1) date (3.3.4) docile (1.4.0) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) + domain_name (0.6.20240107) email_spec (2.2.2) htmlentities (~> 4.3.3) launchy (~> 2.1) mail (~> 2.7) eventmachine (1.2.7) - faraday (2.7.11) + faraday (2.8.1) base64 faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) @@ -66,12 +66,12 @@ GEM domain_name (~> 0.5) i18n (0.9.5) concurrent-ruby (~> 1.0) - json (2.6.3) - json_pure (2.6.3) + json (2.7.1) + json_pure (2.7.1) language_server-protocol (3.17.0.3) launchy (2.5.2) addressable (~> 2.8) - libxml-ruby (4.1.2) + libxml-ruby (5.0.2) logger (1.6.0) macaddr (1.7.2) systemu (~> 2.6.5) @@ -81,9 +81,9 @@ GEM net-pop net-smtp method_source (1.0.0) - mime-types (3.5.1) + mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2023.1003) + mime-types-data (3.2023.1205) mini_mime (1.1.5) minitest (4.7.5) minitest-reporters (0.14.24) @@ -93,21 +93,22 @@ GEM powerbar multi_json (1.15.0) net-http-persistent (2.9.4) - net-imap (0.4.4) + net-imap (0.4.9.1) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0) + net-smtp (0.4.0.1) net-protocol netrc (0.11.0) - oj (3.16.1) + oj (3.16.3) + bigdecimal (>= 3.0) omni_logger (0.1.4) logger - parallel (1.23.0) - parser (3.2.2.4) + parallel (1.24.0) + parser (3.3.0.3) ast (~> 2.4.1) racc pony (1.13.1) @@ -117,7 +118,7 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (5.0.3) + public_suffix (5.0.4) racc (1.7.3) rack (2.2.8) rack-test (0.8.3) @@ -128,9 +129,9 @@ GEM addressable (>= 2.2) redis (5.0.8) redis-client (>= 0.17.0) - redis-client (0.18.0) + redis-client (0.19.1) connection_pool - regexp_parser (2.8.2) + regexp_parser (2.9.0) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) @@ -140,7 +141,7 @@ GEM rsolr (2.5.0) builder (>= 2.1.2) faraday (>= 0.9, < 3, != 2.0.0) - rubocop (1.57.2) + rubocop (1.59.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -148,7 +149,7 @@ GEM rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.30.0) @@ -173,9 +174,6 @@ GEM thread_safe (0.3.6) timeout (0.4.1) tzinfo (0.3.62) - unf (0.1.4) - unf_ext - unf_ext (0.0.8.2) unicode-display_width (2.5.0) uuid (2.3.9) macaddr (~> 1.0) @@ -183,7 +181,6 @@ GEM PLATFORMS aarch64-linux arm64-darwin-22 - x86_64-darwin-21 x86_64-linux DEPENDENCIES @@ -215,4 +212,4 @@ DEPENDENCIES thin BUNDLED WITH - 2.3.15 + 2.3.22 diff --git a/docker-compose.yml b/docker-compose.yml index 912e2ce5..a0138615 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -117,8 +117,7 @@ services: retries: 5 agraph-ut: - # image: franzinc/agraph:v7.3.1 - image: ontoportal/agraph:v7.3.1-patch1 #in place untill agraph v7.4.0 is released + image: franzinc/agraph:v8.0.0 platform: linux/amd64 environment: - AGRAPH_SUPER_USER=test diff --git a/lib/ontologies_linked_data/models/ontology_submission.rb b/lib/ontologies_linked_data/models/ontology_submission.rb index 48365255..a0146920 100644 --- a/lib/ontologies_linked_data/models/ontology_submission.rb +++ b/lib/ontologies_linked_data/models/ontology_submission.rb @@ -147,6 +147,11 @@ def valid? return valid_result && sc end + def remote_pulled? + self.bring(:pullLocation) if self.bring?(:pullLocation) + self.pullLocation != nil + end + def sanity_check self.bring(:ontology) if self.bring?(:ontology) self.ontology.bring(:summaryOnly) if self.ontology.bring?(:summaryOnly) diff --git a/lib/ontologies_linked_data/security/authorization.rb b/lib/ontologies_linked_data/security/authorization.rb index e64fe9f9..7e246326 100644 --- a/lib/ontologies_linked_data/security/authorization.rb +++ b/lib/ontologies_linked_data/security/authorization.rb @@ -78,6 +78,8 @@ def find_apikey(env, params) apikey = params["apikey"] elsif apikey.nil? && header_auth token = Rack::Utils.parse_query(header_auth.split(" ")[1]) + return unless token["token"] + # Strip spaces from start and end of string apikey = token["token"].gsub(/\"/, "") # If the user apikey is passed, use that instead diff --git a/test/rack/test_request_authorization.rb b/test/rack/test_request_authorization.rb index 0852a4c1..c57cebc5 100644 --- a/test/rack/test_request_authorization.rb +++ b/test/rack/test_request_authorization.rb @@ -60,31 +60,32 @@ def _delete_user def test_authorize get "/ontologies" - assert last_response.status == 401 + assert_equal 401, last_response.status + get "/ontologies", {}, {"Authorization" => "bogus auth header"} + assert_equal 401, last_response.status get "/ontologies", {}, {"Authorization" => 'apikey token="'+@apikey+''+'"'} - assert last_response.status == 200 + assert_equal 200, last_response.status apikey = MultiJson.load(last_response.body) assert @apikey.eql?(apikey) get "/ontologies", {}, {"Authorization" => "apikey token=#{@apikey}"} - assert last_response.status == 200 + assert_equal 200, last_response.status apikey = MultiJson.load(last_response.body) - assert @apikey.eql?(apikey) + assert_equal @apikey, apikey get "/ontologies?apikey=#{@apikey}" - assert last_response.status == 200 + assert_equal 200, last_response.status apikey = MultiJson.load(last_response.body) - assert @apikey.eql?(apikey) + assert_equal @apikey, apikey get "/ontologies", {}, {"Authorization" => 'apikey token="'+@apikey+'&userapikey='+@userapikey+'"'} - assert last_response.status == 200 + assert_equal 200, last_response.status apikey = MultiJson.load(last_response.body) - assert @userapikey.eql?(apikey) + assert_equal @userapikey, apikey get "/ontologies", {}, {"Authorization" => "apikey token=#{@apikey}&userapikey=#{@userapikey}"} - assert last_response.status == 200 + assert_equal 200, last_response.status apikey = MultiJson.load(last_response.body) - assert @userapikey.eql?(apikey) + assert_equal @userapikey, apikey get "/ontologies?apikey=#{@apikey}&userapikey=#{@userapikey}" - assert last_response.status == 200 + assert_equal 200, last_response.status apikey = MultiJson.load(last_response.body) - assert @userapikey.eql?(apikey) + assert_equal @userapikey, apikey end - end