Skip to content

Commit

Permalink
Delete more unneeded files
Browse files Browse the repository at this point in the history
  • Loading branch information
Dany Marcoux committed Apr 26, 2021
1 parent fa9ad64 commit f0d4feb
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 277 deletions.
50 changes: 0 additions & 50 deletions src/api/app/controllers/services/webhooks_controller.rb

This file was deleted.

10 changes: 4 additions & 6 deletions src/api/app/models/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def self.check_access?(package)
Project.check_access?(package.project)
end

# This returns a package or nil
def self.check_cache(project, package, opts)
@key = { 'get_by_project_and_name' => 1, :package => package, :opts => opts }

Expand All @@ -132,7 +131,6 @@ def self.check_cache(project, package, opts)
else
project
end
# pid means package id
pid, old_pkg_time, old_prj_time = Rails.cache.read(@key)
if pid
pkg = Package.where(id: pid).includes(:project).first
Expand Down Expand Up @@ -172,13 +170,13 @@ def self.get_by_project_and_name(project, package, opts = {})
return pkg if pkg

prj = internal_get_project(project)
return unless prj # remote projects or can't find the project
return unless prj # remote prjs

if opts[:follow_project_links]
if pkg.nil? && opts[:follow_project_links]
pkg = prj.find_package(package, opts[:check_update_project])
else
elsif pkg.nil?
pkg = prj.update_instance.packages.find_by_name(package) if opts[:check_update_project]
pkg ||= prj.packages.find_by_name(package)
pkg = prj.packages.find_by_name(package) if pkg.nil?
end

# FIXME: Why is this returning nil (the package is not found) if _ANY_ of the
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/token/rebuild.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def self.token_name
end

def call(options)
# TODO: Use the Package#rebuild? instead of calling the Backend directly
# FIXME: Use the Package#rebuild? instead of calling the Backend directly
Backend::Api::Sources::Package.rebuild(package_from_association_or_params.project.name,
package_from_association_or_params.name,
options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ def rebuild?

# When we're in a linked project, the package's project points to some other
# project, not the one we're triggering the build from.
def linked_project?
@project != @package.project if @package
end

# Here we detect if we're on a linked project, and if so, we authorize against the linked project.
# Here we detect that, and if so, we authorize against the linked project.
def policy_object
return @project if linked_project?
return @project if @project != @package.project

@package
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,14 @@ def extract_token_from_request_signature
return token if token && token.valid_signature?(signature, @body)
end

# from Token::Service
def valid_signature?(signature)
return false unless signature

ActiveSupport::SecurityUtils.secure_compare(signature_of(@body), signature)
end

# from Token::Service
def signature_of
# TODO: use sha256 (from X-Hub-Signature-256)
# FIXME: use sha256 (from X-Hub-Signature-256)
'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), string, @body)
end

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

97 changes: 0 additions & 97 deletions src/api/spec/controllers/services/webhooks_controller_spec.rb

This file was deleted.

0 comments on commit f0d4feb

Please sign in to comment.