Skip to content

Commit

Permalink
Merge pull request #15 from discoverygarden/feature/cantaloupe-5
Browse files Browse the repository at this point in the history
DO NOT MERGE: DDST-235: Cantaloupe 5 support.
  • Loading branch information
nchiasson-dgi authored Jun 27, 2024
2 parents fc5b53e + eddec0b commit 281efbc
Show file tree
Hide file tree
Showing 2 changed files with 243 additions and 62 deletions.
11 changes: 7 additions & 4 deletions default_i8_delegates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
end

class CustomDelegate
old_function = instance_method(:httpsource_resource_info)
old_functions = {
:httpsource_resource_info => instance_method(:httpsource_resource_info),
:pre_authorize => instance_method(:pre_authorize)
}

# Get the resource suffix for the given ID.
def _suffix
Expand Down Expand Up @@ -65,7 +68,7 @@ def httpsource_resource_info(options = {})

return to_return
else
return old_function.bind(self).call
return old_functions[:httpsource_resource_info].bind(self).call
end
end

Expand Down Expand Up @@ -125,7 +128,7 @@ def _fetch(uri, limit = 10)
end

# Override; handle I8 resource auth.
def authorize(options = {})
def pre_authorize(options = {})
# If...
if _resource
# ... we have something that appears to be an I8 resource, enforce auth...
Expand Down Expand Up @@ -155,7 +158,7 @@ def authorize(options = {})
else
# ... otherwise, pass it, assuming it should contain an auth token in the
# URL.
return true
return old_functions[:pre_authorize].bind(self).call
end
end

Expand Down
Loading

0 comments on commit 281efbc

Please # to comment.