mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
Revert "Use inflector rule to acronym Api to API"
This reverts commit 06f5eb10d4
.
This commit is contained in:
parent
90b2455032
commit
aac76b333c
25 changed files with 43 additions and 44 deletions
|
@ -1,20 +1,20 @@
|
|||
module Admin
|
||||
class APIUsersController < BaseController
|
||||
class ApiUsersController < BaseController
|
||||
load_and_authorize_resource
|
||||
before_action :set_api_user, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@q = APIUser.includes(:registrar).search(params[:q])
|
||||
@q = ApiUser.includes(:registrar).search(params[:q])
|
||||
@api_users = @q.result.page(params[:page])
|
||||
end
|
||||
|
||||
def new
|
||||
@registrar = Registrar.find_by(id: params[:registrar_id])
|
||||
@api_user = APIUser.new(registrar: @registrar)
|
||||
@api_user = ApiUser.new(registrar: @registrar)
|
||||
end
|
||||
|
||||
def create
|
||||
@api_user = APIUser.new(api_user_params)
|
||||
@api_user = ApiUser.new(api_user_params)
|
||||
|
||||
if @api_user.save
|
||||
flash[:notice] = I18n.t('record_created')
|
||||
|
@ -55,7 +55,7 @@ module Admin
|
|||
private
|
||||
|
||||
def set_api_user
|
||||
@api_user = APIUser.find(params[:id])
|
||||
@api_user = ApiUser.find(params[:id])
|
||||
end
|
||||
|
||||
def api_user_params
|
||||
|
|
|
@ -7,12 +7,12 @@ module Admin
|
|||
end
|
||||
|
||||
def new
|
||||
@api_user = APIUser.find(params[:api_user_id])
|
||||
@api_user = ApiUser.find(params[:api_user_id])
|
||||
@certificate = Certificate.new(api_user: @api_user)
|
||||
end
|
||||
|
||||
def create
|
||||
@api_user = APIUser.find(params[:api_user_id])
|
||||
@api_user = ApiUser.find(params[:api_user_id])
|
||||
|
||||
crt = certificate_params[:crt].open.read if certificate_params[:crt]
|
||||
csr = certificate_params[:csr].open.read if certificate_params[:csr]
|
||||
|
@ -73,7 +73,7 @@ module Admin
|
|||
end
|
||||
|
||||
def set_api_user
|
||||
@api_user = APIUser.find(params[:api_user_id])
|
||||
@api_user = ApiUser.find(params[:api_user_id])
|
||||
end
|
||||
|
||||
def certificate_params
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'rails5_api_controller_backport'
|
||||
require 'auth_token/auth_token_creator'
|
||||
|
||||
module API
|
||||
module Api
|
||||
module V1
|
||||
module Registrant
|
||||
class AuthController < ActionController::API
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'rails5_api_controller_backport'
|
||||
require 'auth_token/auth_token_decryptor'
|
||||
|
||||
module API
|
||||
module Api
|
||||
module V1
|
||||
module Registrant
|
||||
class BaseController < ActionController::API
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'rails5_api_controller_backport'
|
||||
require 'auth_token/auth_token_decryptor'
|
||||
|
||||
module API
|
||||
module Api
|
||||
module V1
|
||||
module Registrant
|
||||
class DomainsController < BaseController
|
||||
|
|
|
@ -7,7 +7,7 @@ class Epp::SessionsController < EppController
|
|||
|
||||
def login
|
||||
success = true
|
||||
@api_user = APIUser.find_by(login_params)
|
||||
@api_user = ApiUser.find_by(login_params)
|
||||
|
||||
webclient_request = ENV['webclient_ips'].split(',').map(&:strip).include?(request.ip)
|
||||
if webclient_request && !Rails.env.test? && !Rails.env.development?
|
||||
|
|
|
@ -95,6 +95,6 @@ class Registrant::SessionsController < Devise::SessionsController
|
|||
|
||||
def find_user_by_idc(idc)
|
||||
return User.new unless idc
|
||||
APIUser.find_by(identity_code: idc) || User.new
|
||||
ApiUser.find_by(identity_code: idc) || User.new
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ class Registrar
|
|||
private
|
||||
|
||||
def new_user
|
||||
@new_user ||= APIUser.find(params[:new_user_id])
|
||||
@new_user ||= ApiUser.find(params[:new_user_id])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,7 +26,7 @@ class Registrar
|
|||
@depp_user.errors.add(:base, :webserver_client_cert_directive_should_be_required)
|
||||
end
|
||||
|
||||
@api_user = APIUser.find_by(username: params[:depp_user][:tag], password: params[:depp_user][:password])
|
||||
@api_user = ApiUser.find_by(username: params[:depp_user][:tag], password: params[:depp_user][:password])
|
||||
|
||||
unless @api_user
|
||||
@depp_user.errors.add(:base, t(:no_such_user))
|
||||
|
@ -53,7 +53,7 @@ class Registrar
|
|||
end
|
||||
|
||||
def id
|
||||
@user = APIUser.find_by_idc_data_and_allowed(request.env['SSL_CLIENT_S_DN'], request.ip)
|
||||
@user = ApiUser.find_by_idc_data_and_allowed(request.env['SSL_CLIENT_S_DN'], request.ip)
|
||||
|
||||
if @user
|
||||
sign_in(@user, event: :authentication)
|
||||
|
@ -150,12 +150,12 @@ class Registrar
|
|||
|
||||
def find_user_by_idc(idc)
|
||||
return User.new unless idc
|
||||
APIUser.find_by(identity_code: idc) || User.new
|
||||
ApiUser.find_by(identity_code: idc) || User.new
|
||||
end
|
||||
|
||||
def find_user_by_idc_and_allowed(idc)
|
||||
return User.new unless idc
|
||||
possible_users = APIUser.where(identity_code: idc) || User.new
|
||||
possible_users = ApiUser.where(identity_code: idc) || User.new
|
||||
possible_users.each do |selected_user|
|
||||
if selected_user.registrar.white_ips.registrar_area.include_ip?(request.ip)
|
||||
return selected_user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue