Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexskr committed Jan 12, 2024
2 parents 7783784 + 4b6b7f4 commit ee0013f
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 41 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
49 changes: 23 additions & 26 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/ncbo/goo.git
revision: 657149d6b33813253fa7440252f69c04e0631190
revision: 75436fe8e387febc53e34ee31ff0e6dd837a9d3f
branch: master
specs:
goo (0.0.2)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -140,15 +141,15 @@ 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)
parser (>= 3.2.2.4)
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)
Expand All @@ -173,17 +174,13 @@ 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)

PLATFORMS
aarch64-linux
arm64-darwin-22
x86_64-darwin-21
x86_64-linux

DEPENDENCIES
Expand Down Expand Up @@ -215,4 +212,4 @@ DEPENDENCIES
thin

BUNDLED WITH
2.3.15
2.3.22
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions lib/ontologies_linked_data/models/ontology_submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions lib/ontologies_linked_data/security/authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 14 additions & 13 deletions test/rack/test_request_authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ee0013f

Please sign in to comment.