mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 13:44:47 +02:00
Remove Grape from codebase
This commit is contained in:
parent
951a3f247b
commit
b8311ac5f6
3 changed files with 0 additions and 109 deletions
2
Gemfile
2
Gemfile
|
@ -35,8 +35,6 @@ gem 'select2-rails', '3.5.9.3' # for autocomplete
|
|||
gem 'cancancan'
|
||||
gem 'devise', '~> 4.7'
|
||||
|
||||
gem 'grape'
|
||||
|
||||
# registry specfic
|
||||
gem 'data_migrate', '~> 6.1'
|
||||
gem 'isikukood' # for EE-id validation
|
||||
|
|
34
Gemfile.lock
34
Gemfile.lock
|
@ -196,28 +196,6 @@ GEM
|
|||
docile (1.3.2)
|
||||
domain_name (0.5.20190701)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
dry-configurable (0.11.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
dry-core (~> 0.4, >= 0.4.7)
|
||||
dry-equalizer (~> 0.2)
|
||||
dry-container (0.7.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
dry-configurable (~> 0.1, >= 0.1.3)
|
||||
dry-core (0.4.9)
|
||||
concurrent-ruby (~> 1.0)
|
||||
dry-equalizer (0.3.0)
|
||||
dry-inflector (0.2.0)
|
||||
dry-logic (1.0.7)
|
||||
concurrent-ruby (~> 1.0)
|
||||
dry-core (~> 0.2)
|
||||
dry-equalizer (~> 0.2)
|
||||
dry-types (1.4.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
dry-container (~> 0.3)
|
||||
dry-core (~> 0.4, >= 0.4.4)
|
||||
dry-equalizer (~> 0.3)
|
||||
dry-inflector (~> 0.1, >= 0.1.2)
|
||||
dry-logic (~> 1.0, >= 1.0.2)
|
||||
erubi (1.9.0)
|
||||
erubis (2.7.0)
|
||||
execjs (2.7.0)
|
||||
|
@ -226,13 +204,6 @@ GEM
|
|||
thor (~> 0.14)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
grape (1.4.0)
|
||||
activesupport
|
||||
builder
|
||||
dry-types (>= 1.1)
|
||||
mustermann-grape (~> 1.0.0)
|
||||
rack (>= 1.3.0)
|
||||
rack-accept
|
||||
gyoku (1.3.1)
|
||||
builder (>= 2.1.2)
|
||||
haml (5.1.2)
|
||||
|
@ -312,8 +283,6 @@ GEM
|
|||
multi_json (1.15.0)
|
||||
mustermann (1.1.1)
|
||||
ruby2_keywords (~> 0.0.1)
|
||||
mustermann-grape (1.0.1)
|
||||
mustermann (>= 1.0.0)
|
||||
netrc (0.11.0)
|
||||
nio4r (2.5.4)
|
||||
nokogiri (1.10.10)
|
||||
|
@ -357,8 +326,6 @@ GEM
|
|||
que (~> 0.8)
|
||||
sinatra
|
||||
rack (2.2.3)
|
||||
rack-accept (0.4.5)
|
||||
rack (>= 0.4)
|
||||
rack-oauth2 (1.16.0)
|
||||
activesupport
|
||||
attr_required
|
||||
|
@ -542,7 +509,6 @@ DEPENDENCIES
|
|||
epp!
|
||||
epp-xml (= 1.1.0)!
|
||||
figaro (= 1.1.1)
|
||||
grape
|
||||
haml (~> 5.0)
|
||||
isikukood
|
||||
iso8601 (= 0.12.1)
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
module Repp
|
||||
class API < Grape::API
|
||||
format :json
|
||||
prefix :repp
|
||||
|
||||
rescue_from Grape::Exceptions::ValidationErrors do |e|
|
||||
messages = e.full_messages
|
||||
errors = []
|
||||
messages.each { |m| errors << { code: 2003, message: m } }
|
||||
|
||||
error!({ errors: errors }, 400)
|
||||
end
|
||||
|
||||
http_basic do |username, password|
|
||||
@current_user ||= ApiUser.find_by(username: username, plain_text_password: password)
|
||||
if @current_user
|
||||
true
|
||||
else
|
||||
error! I18n.t('api_user_not_found'), 401
|
||||
end
|
||||
end
|
||||
|
||||
before do
|
||||
webclient_request = ENV['webclient_ips'].split(',').map(&:strip).include?(request.ip)
|
||||
unless webclient_request
|
||||
error! I18n.t('api.authorization.ip_not_allowed', ip: request.ip), 401 unless @current_user.registrar.api_ip_white?(request.ip)
|
||||
end
|
||||
|
||||
if @current_user.cannot?(:view, :repp)
|
||||
error! I18n.t('no_permission'), 401 unless @current_user.registrar.api_ip_white?(request.ip)
|
||||
end
|
||||
|
||||
next if Rails.env.test? || Rails.env.development?
|
||||
message = 'Certificate mismatch! Cert common name should be:'
|
||||
request_name = env['HTTP_SSL_CLIENT_S_DN_CN']
|
||||
|
||||
if webclient_request
|
||||
webclient_cert_name = ENV['webclient_cert_common_name'] || 'webclient'
|
||||
error! "Webclient #{message} #{webclient_cert_name}", 401 if webclient_cert_name != request_name
|
||||
else
|
||||
unless @current_user.pki_ok?(request.env['HTTP_SSL_CLIENT_CERT'],
|
||||
request.env['HTTP_SSL_CLIENT_S_DN_CN'])
|
||||
error! "#{message} #{@current_user.username}", 401
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
helpers do
|
||||
attr_reader :current_user
|
||||
end
|
||||
|
||||
after do
|
||||
ApiLog::ReppLog.create({
|
||||
request_path: request.path,
|
||||
request_method: request.request_method,
|
||||
request_params: request.params.except('route_info').to_json,
|
||||
response: @response.to_json,
|
||||
response_code: status,
|
||||
api_user_name: current_user.try(:username),
|
||||
api_user_registrar: current_user.try(:registrar).try(:to_s),
|
||||
ip: request.ip,
|
||||
uuid: request.try(:uuid)
|
||||
})
|
||||
end
|
||||
|
||||
mount Repp::DomainV1
|
||||
mount Repp::ContactV1
|
||||
mount Repp::AccountV1
|
||||
mount Repp::DomainTransfersV1
|
||||
mount Repp::NameserversV1
|
||||
mount Repp::DomainContactsV1
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue