mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Use BaseController in admin
This commit is contained in:
parent
cee4c84edd
commit
a63b989cd6
36 changed files with 1265 additions and 1215 deletions
|
@ -1,60 +1,62 @@
|
||||||
class Admin::AccountActivitiesController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class AccountActivitiesController < BaseController
|
||||||
before_action :set_default_dates, only: [:index]
|
load_and_authorize_resource
|
||||||
|
before_action :set_default_dates, only: [:index]
|
||||||
|
|
||||||
def index # rubocop: disable Metrics/AbcSize
|
def index # rubocop: disable Metrics/AbcSize
|
||||||
|
|
||||||
ca_cache = params[:q][:created_at_lteq]
|
ca_cache = params[:q][:created_at_lteq]
|
||||||
begin
|
begin
|
||||||
end_time = params[:q][:created_at_lteq].try(:to_date)
|
end_time = params[:q][:created_at_lteq].try(:to_date)
|
||||||
params[:q][:created_at_lteq] = end_time.try(:end_of_day)
|
params[:q][:created_at_lteq] = end_time.try(:end_of_day)
|
||||||
rescue
|
rescue
|
||||||
logger.warn('Invalid date')
|
logger.warn('Invalid date')
|
||||||
end
|
|
||||||
|
|
||||||
balance_params = params[:q].deep_dup
|
|
||||||
|
|
||||||
if balance_params[:created_at_gteq]
|
|
||||||
balance_params.delete('created_at_gteq')
|
|
||||||
end
|
|
||||||
|
|
||||||
@q = AccountActivity.includes(:invoice, account: :registrar).search(params[:q])
|
|
||||||
@b = AccountActivity.search(balance_params)
|
|
||||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
|
||||||
|
|
||||||
@account_activities = @q.result.page(params[:page]).per(params[:results_per_page])
|
|
||||||
sort = @account_activities.orders.map(&:to_sql).join(",")
|
|
||||||
|
|
||||||
# can do here inline SQL as it's our
|
|
||||||
if params[:page] && params[:page].to_i > 1
|
|
||||||
@sum = @q.result.reorder(sort).limit(@account_activities.offset_value).sum(:sum) + @b.result.where("account_activities.id NOT IN (#{@q.result.select(:id).to_sql})").sum(:sum)
|
|
||||||
else
|
|
||||||
@sum = @b.result.where("account_activities.id NOT IN (#{@q.result.select(:id).to_sql})").sum(:sum)
|
|
||||||
end
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.csv do
|
|
||||||
send_data @q.result.to_csv, filename: "account_activities_#{Time.zone.now.to_formatted_s(:number)}.csv"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
params[:q][:created_at_lteq] = ca_cache
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_default_dates
|
|
||||||
params[:q] ||= {}
|
|
||||||
|
|
||||||
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
|
||||||
|
|
||||||
default_date = params[:created_after]
|
|
||||||
|
|
||||||
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
|
||||||
default_date = 'today'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
balance_params = params[:q].deep_dup
|
||||||
|
|
||||||
|
if balance_params[:created_at_gteq]
|
||||||
|
balance_params.delete('created_at_gteq')
|
||||||
|
end
|
||||||
|
|
||||||
|
@q = AccountActivity.includes(:invoice, account: :registrar).search(params[:q])
|
||||||
|
@b = AccountActivity.search(balance_params)
|
||||||
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
|
|
||||||
|
@account_activities = @q.result.page(params[:page]).per(params[:results_per_page])
|
||||||
|
sort = @account_activities.orders.map(&:to_sql).join(",")
|
||||||
|
|
||||||
|
# can do here inline SQL as it's our
|
||||||
|
if params[:page] && params[:page].to_i > 1
|
||||||
|
@sum = @q.result.reorder(sort).limit(@account_activities.offset_value).sum(:sum) + @b.result.where("account_activities.id NOT IN (#{@q.result.select(:id).to_sql})").sum(:sum)
|
||||||
|
else
|
||||||
|
@sum = @b.result.where("account_activities.id NOT IN (#{@q.result.select(:id).to_sql})").sum(:sum)
|
||||||
|
end
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.csv do
|
||||||
|
send_data @q.result.to_csv, filename: "account_activities_#{Time.zone.now.to_formatted_s(:number)}.csv"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
params[:q][:created_at_lteq] = ca_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_default_dates
|
||||||
|
params[:q] ||= {}
|
||||||
|
|
||||||
|
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
||||||
|
|
||||||
|
default_date = params[:created_after]
|
||||||
|
|
||||||
|
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
||||||
|
default_date = 'today'
|
||||||
|
end
|
||||||
|
|
||||||
|
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,63 +1,67 @@
|
||||||
class Admin::AdminUsersController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class AdminUsersController < BaseController
|
||||||
before_action :set_user, only: [:show, :edit, :update, :destroy]
|
load_and_authorize_resource
|
||||||
|
before_action :set_user, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@q = AdminUser.search(params[:q])
|
@q = AdminUser.search(params[:q])
|
||||||
@admin_users = @q.result.page(params[:page]).order(:username)
|
@admin_users = @q.result.page(params[:page]).order(:username)
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
@admin_user = AdminUser.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def show; end
|
|
||||||
|
|
||||||
def edit; end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@admin_user = AdminUser.new(admin_user_params)
|
|
||||||
|
|
||||||
if @admin_user.save
|
|
||||||
flash[:notice] = I18n.t('record_created')
|
|
||||||
redirect_to [:admin, @admin_user]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_create_record')
|
|
||||||
render 'new'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
def new
|
||||||
params[:admin_user].delete(:password) if params[:admin_user][:password].blank?
|
@admin_user = AdminUser.new
|
||||||
params[:admin_user].delete(:password_confirmation) if params[:admin_user][:password_confirmation].blank?
|
|
||||||
|
|
||||||
if @admin_user.update_attributes(admin_user_params)
|
|
||||||
flash[:notice] = I18n.t('record_updated')
|
|
||||||
redirect_to [:admin, @admin_user]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_update_record')
|
|
||||||
render 'edit'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def show;
|
||||||
if @admin_user.destroy
|
|
||||||
flash[:notice] = I18n.t('record_deleted')
|
|
||||||
redirect_to admin_admin_users_path
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_delete_record')
|
|
||||||
render 'show'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
def edit;
|
||||||
|
end
|
||||||
|
|
||||||
def set_user
|
def create
|
||||||
@admin_user = AdminUser.find(params[:id])
|
@admin_user = AdminUser.new(admin_user_params)
|
||||||
end
|
|
||||||
|
|
||||||
def admin_user_params
|
if @admin_user.save
|
||||||
params.require(:admin_user).permit(:username,
|
flash[:notice] = I18n.t('record_created')
|
||||||
:password, :password_confirmation, :identity_code, :email, :country_code, { roles: [] })
|
redirect_to [:admin, @admin_user]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_create_record')
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
params[:admin_user].delete(:password) if params[:admin_user][:password].blank?
|
||||||
|
params[:admin_user].delete(:password_confirmation) if params[:admin_user][:password_confirmation].blank?
|
||||||
|
|
||||||
|
if @admin_user.update_attributes(admin_user_params)
|
||||||
|
flash[:notice] = I18n.t('record_updated')
|
||||||
|
redirect_to [:admin, @admin_user]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_update_record')
|
||||||
|
render 'edit'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
if @admin_user.destroy
|
||||||
|
flash[:notice] = I18n.t('record_deleted')
|
||||||
|
redirect_to admin_admin_users_path
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_delete_record')
|
||||||
|
render 'show'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_user
|
||||||
|
@admin_user = AdminUser.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def admin_user_params
|
||||||
|
params.require(:admin_user).permit(:username,
|
||||||
|
:password, :password_confirmation, :identity_code, :email, :country_code, { roles: [] })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,63 +1,67 @@
|
||||||
class Admin::ApiUsersController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class ApiUsersController < BaseController
|
||||||
before_action :set_api_user, only: [:show, :edit, :update, :destroy]
|
load_and_authorize_resource
|
||||||
|
before_action :set_api_user, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@q = ApiUser.includes(:registrar).search(params[:q])
|
@q = ApiUser.includes(:registrar).search(params[:q])
|
||||||
@api_users = @q.result.page(params[:page])
|
@api_users = @q.result.page(params[:page])
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
@registrar = Registrar.find_by(id: params[:registrar_id])
|
|
||||||
@api_user = ApiUser.new(registrar: @registrar)
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@api_user = ApiUser.new(api_user_params)
|
|
||||||
|
|
||||||
if @api_user.save
|
|
||||||
flash[:notice] = I18n.t('record_created')
|
|
||||||
redirect_to [:admin, @api_user]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_create_record')
|
|
||||||
render 'new'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def show; end
|
def new
|
||||||
|
@registrar = Registrar.find_by(id: params[:registrar_id])
|
||||||
def edit; end
|
@api_user = ApiUser.new(registrar: @registrar)
|
||||||
|
|
||||||
def update
|
|
||||||
params[:api_user].delete(:password) if params[:api_user][:password].blank?
|
|
||||||
if @api_user.update(api_user_params)
|
|
||||||
flash[:notice] = I18n.t('record_updated')
|
|
||||||
redirect_to [:admin, @api_user]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_update_record')
|
|
||||||
render 'edit'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def create
|
||||||
if @api_user.destroy
|
@api_user = ApiUser.new(api_user_params)
|
||||||
flash[:notice] = I18n.t('record_deleted')
|
|
||||||
redirect_to admin_api_users_path
|
if @api_user.save
|
||||||
else
|
flash[:notice] = I18n.t('record_created')
|
||||||
flash.now[:alert] = I18n.t('failed_to_delete_record')
|
redirect_to [:admin, @api_user]
|
||||||
render 'show'
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_create_record')
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
def show;
|
||||||
|
end
|
||||||
|
|
||||||
def set_api_user
|
def edit;
|
||||||
@api_user = ApiUser.find(params[:id])
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def api_user_params
|
def update
|
||||||
params.require(:api_user).permit(:username, :password, :active,
|
params[:api_user].delete(:password) if params[:api_user][:password].blank?
|
||||||
:registrar_id, :registrar_typeahead,
|
if @api_user.update(api_user_params)
|
||||||
:identity_code, { roles: [] })
|
flash[:notice] = I18n.t('record_updated')
|
||||||
|
redirect_to [:admin, @api_user]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_update_record')
|
||||||
|
render 'edit'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
if @api_user.destroy
|
||||||
|
flash[:notice] = I18n.t('record_deleted')
|
||||||
|
redirect_to admin_api_users_path
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_delete_record')
|
||||||
|
render 'show'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_api_user
|
||||||
|
@api_user = ApiUser.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def api_user_params
|
||||||
|
params.require(:api_user).permit(:username, :password, :active,
|
||||||
|
:registrar_id, :registrar_typeahead,
|
||||||
|
:identity_code, { roles: [] })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,87 +1,89 @@
|
||||||
class Admin::BankStatementsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class BankStatementsController < BaseController
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
before_action :set_bank_statement, only: [:show, :download_import_file, :bind_invoices]
|
before_action :set_bank_statement, only: [:show, :download_import_file, :bind_invoices]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@q = BankStatement.search(params[:q])
|
@q = BankStatement.search(params[:q])
|
||||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
@bank_statements = @q.result.page(params[:page])
|
@bank_statements = @q.result.page(params[:page])
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
@q = @bank_statement.bank_transactions.includes(:account_activity).search(params[:q])
|
|
||||||
@q.sorts = 'account_activity_id desc' if @q.sorts.empty?
|
|
||||||
@bank_transactions = @q.result.page(params[:page])
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
@bank_statement = BankStatement.new(
|
|
||||||
bank_code: Setting.registry_bank_code,
|
|
||||||
iban: Setting.registry_iban
|
|
||||||
)
|
|
||||||
@invoice = Invoice.find_by(id: params[:invoice_id])
|
|
||||||
@bank_transaction = @bank_statement.bank_transactions.build(
|
|
||||||
description: @invoice.to_s,
|
|
||||||
sum: @invoice.sum,
|
|
||||||
reference_no: @invoice.reference_no,
|
|
||||||
paid_at: Time.zone.now.to_date,
|
|
||||||
currency: 'EUR'
|
|
||||||
) if @invoice
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@bank_statement = BankStatement.new(bank_statement_params)
|
|
||||||
|
|
||||||
if @bank_statement.save
|
|
||||||
flash[:notice] = I18n.t('record_created')
|
|
||||||
redirect_to [:admin, @bank_statement]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_create_record')
|
|
||||||
render 'new'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def import
|
def show
|
||||||
@bank_statement = BankStatement.new
|
@q = @bank_statement.bank_transactions.includes(:account_activity).search(params[:q])
|
||||||
end
|
@q.sorts = 'account_activity_id desc' if @q.sorts.empty?
|
||||||
|
@bank_transactions = @q.result.page(params[:page])
|
||||||
def create_from_import
|
|
||||||
@bank_statement = BankStatement.new(bank_statement_params)
|
|
||||||
|
|
||||||
if @bank_statement.import
|
|
||||||
flash[:notice] = I18n.t('record_created')
|
|
||||||
redirect_to [:admin, @bank_statement]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_create_record')
|
|
||||||
render 'new'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def bind_invoices
|
def new
|
||||||
@bank_statement.bind_invoices
|
@bank_statement = BankStatement.new(
|
||||||
|
bank_code: Setting.registry_bank_code,
|
||||||
|
iban: Setting.registry_iban
|
||||||
|
)
|
||||||
|
@invoice = Invoice.find_by(id: params[:invoice_id])
|
||||||
|
@bank_transaction = @bank_statement.bank_transactions.build(
|
||||||
|
description: @invoice.to_s,
|
||||||
|
sum: @invoice.sum,
|
||||||
|
reference_no: @invoice.reference_no,
|
||||||
|
paid_at: Time.zone.now.to_date,
|
||||||
|
currency: 'EUR'
|
||||||
|
) if @invoice
|
||||||
|
end
|
||||||
|
|
||||||
flash[:notice] = t('invoices_were_fully_binded') if @bank_statement.fully_binded?
|
def create
|
||||||
flash[:warning] = t('invoices_were_partially_binded') if @bank_statement.partially_binded?
|
@bank_statement = BankStatement.new(bank_statement_params)
|
||||||
flash[:alert] = t('no_invoices_were_binded') if @bank_statement.not_binded?
|
|
||||||
|
|
||||||
redirect_to [:admin, @bank_statement]
|
if @bank_statement.save
|
||||||
end
|
flash[:notice] = I18n.t('record_created')
|
||||||
|
redirect_to [:admin, @bank_statement]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_create_record')
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def download_import_file
|
def import
|
||||||
filename = @bank_statement.import_file_path.split('/').last
|
@bank_statement = BankStatement.new
|
||||||
send_data File.open(@bank_statement.import_file_path, 'r').read, filename: filename
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
def create_from_import
|
||||||
|
@bank_statement = BankStatement.new(bank_statement_params)
|
||||||
|
|
||||||
def set_bank_statement
|
if @bank_statement.import
|
||||||
@bank_statement = BankStatement.find(params[:id])
|
flash[:notice] = I18n.t('record_created')
|
||||||
end
|
redirect_to [:admin, @bank_statement]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_create_record')
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def bank_statement_params
|
def bind_invoices
|
||||||
params.require(:bank_statement).permit(:th6_file, :bank_code, :iban, bank_transactions_attributes: [
|
@bank_statement.bind_invoices
|
||||||
:description, :sum, :currency, :reference_no, :paid_at
|
|
||||||
])
|
flash[:notice] = t('invoices_were_fully_binded') if @bank_statement.fully_binded?
|
||||||
|
flash[:warning] = t('invoices_were_partially_binded') if @bank_statement.partially_binded?
|
||||||
|
flash[:alert] = t('no_invoices_were_binded') if @bank_statement.not_binded?
|
||||||
|
|
||||||
|
redirect_to [:admin, @bank_statement]
|
||||||
|
end
|
||||||
|
|
||||||
|
def download_import_file
|
||||||
|
filename = @bank_statement.import_file_path.split('/').last
|
||||||
|
send_data File.open(@bank_statement.import_file_path, 'r').read, filename: filename
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_bank_statement
|
||||||
|
@bank_statement = BankStatement.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def bank_statement_params
|
||||||
|
params.require(:bank_statement).permit(:th6_file, :bank_code, :iban, bank_transactions_attributes: [
|
||||||
|
:description, :sum, :currency, :reference_no, :paid_at
|
||||||
|
])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,54 +1,56 @@
|
||||||
class Admin::BankTransactionsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class BankTransactionsController < BaseController
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@bank_statement = BankStatement.find(params[:bank_statement_id])
|
@bank_statement = BankStatement.find(params[:bank_statement_id])
|
||||||
@bank_transaction = BankTransaction.new(currency: 'EUR')
|
@bank_transaction = BankTransaction.new(currency: 'EUR')
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
comma_support_for(:bank_transaction, :sum)
|
|
||||||
@bank_transaction = BankTransaction.new(
|
|
||||||
bank_transaction_params.merge(bank_statement_id: params[:bank_statement_id])
|
|
||||||
)
|
|
||||||
|
|
||||||
if @bank_transaction.save
|
|
||||||
flash[:notice] = I18n.t('record_created')
|
|
||||||
redirect_to [:admin, @bank_transaction]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_create_record')
|
|
||||||
render 'new'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
def create
|
||||||
comma_support_for(:bank_transaction, :sum)
|
comma_support_for(:bank_transaction, :sum)
|
||||||
if @bank_transaction.update(bank_transaction_params)
|
@bank_transaction = BankTransaction.new(
|
||||||
flash[:notice] = I18n.t('record_updated')
|
bank_transaction_params.merge(bank_statement_id: params[:bank_statement_id])
|
||||||
redirect_to [:admin, @bank_transaction]
|
)
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_update_record')
|
if @bank_transaction.save
|
||||||
render 'edit'
|
flash[:notice] = I18n.t('record_created')
|
||||||
|
redirect_to [:admin, @bank_transaction]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_create_record')
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def bind
|
def update
|
||||||
if @bank_transaction.bind_invoice(params[:invoice_no])
|
comma_support_for(:bank_transaction, :sum)
|
||||||
flash[:notice] = I18n.t('record_created')
|
if @bank_transaction.update(bank_transaction_params)
|
||||||
redirect_to [:admin, @bank_transaction]
|
flash[:notice] = I18n.t('record_updated')
|
||||||
else
|
redirect_to [:admin, @bank_transaction]
|
||||||
flash.now[:alert] = I18n.t('failed_to_create_record')
|
else
|
||||||
render 'show'
|
flash.now[:alert] = I18n.t('failed_to_update_record')
|
||||||
|
render 'edit'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
def bind
|
||||||
|
if @bank_transaction.bind_invoice(params[:invoice_no])
|
||||||
|
flash[:notice] = I18n.t('record_created')
|
||||||
|
redirect_to [:admin, @bank_transaction]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_create_record')
|
||||||
|
render 'show'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def bank_transaction_params
|
private
|
||||||
params.require(:bank_transaction).permit(
|
|
||||||
:description, :sum, :reference_no, :document_no,
|
def bank_transaction_params
|
||||||
:bank_reference, :iban, :buyer_bank_code, :buyer_iban,
|
params.require(:bank_transaction).permit(
|
||||||
:buyer_name, :currency, :paid_at
|
:description, :sum, :reference_no, :document_no,
|
||||||
)
|
:bank_reference, :iban, :buyer_bank_code, :buyer_iban,
|
||||||
|
:buyer_name, :currency, :paid_at
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
10
app/controllers/admin/base_controller.rb
Normal file
10
app/controllers/admin/base_controller.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
module Admin
|
||||||
|
class BaseController < ApplicationController
|
||||||
|
before_action :authenticate_user!
|
||||||
|
helper_method :head_title_sufix
|
||||||
|
|
||||||
|
def head_title_sufix
|
||||||
|
t(:admin_head_title_sufix)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
module Admin
|
module Admin
|
||||||
module Billing
|
module Billing
|
||||||
class PricesController < AdminController
|
class PricesController < BaseController
|
||||||
authorize_resource(class: 'Billing::Price')
|
authorize_resource(class: 'Billing::Price')
|
||||||
before_action :load_price, only: %i[edit update expire]
|
before_action :load_price, only: %i[edit update expire]
|
||||||
helper_method :zones
|
helper_method :zones
|
||||||
|
|
|
@ -1,55 +1,57 @@
|
||||||
class Admin::BlockedDomainsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class BlockedDomainsController < BaseController
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
domains = BlockedDomain.all.order(:name)
|
domains = BlockedDomain.all.order(:name)
|
||||||
@q = domains.search(params[:q])
|
@q = domains.search(params[:q])
|
||||||
@domains = @q.result.page(params[:page])
|
@domains = @q.result.page(params[:page])
|
||||||
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
|
|
||||||
@domain = BlockedDomain.new
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
|
|
||||||
@domain = BlockedDomain.new(blocked_domain_params)
|
|
||||||
|
|
||||||
if @domain.save
|
|
||||||
flash[:notice] = I18n.t('domain_added')
|
|
||||||
redirect_to admin_blocked_domains_path
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_add_domain')
|
|
||||||
render 'new'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
def new
|
||||||
|
|
||||||
def delete
|
@domain = BlockedDomain.new
|
||||||
|
|
||||||
if BlockedDomain.find(params[:id]).destroy
|
end
|
||||||
flash[:notice] = I18n.t('domain_deleted')
|
|
||||||
redirect_to admin_blocked_domains_path
|
def create
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_delete_domain')
|
@domain = BlockedDomain.new(blocked_domain_params)
|
||||||
redirect_to admin_blocked_domains_path
|
|
||||||
|
if @domain.save
|
||||||
|
flash[:notice] = I18n.t('domain_added')
|
||||||
|
redirect_to admin_blocked_domains_path
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_add_domain')
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete
|
||||||
|
|
||||||
|
if BlockedDomain.find(params[:id]).destroy
|
||||||
|
flash[:notice] = I18n.t('domain_deleted')
|
||||||
|
redirect_to admin_blocked_domains_path
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_delete_domain')
|
||||||
|
redirect_to admin_blocked_domains_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def blocked_domain_params
|
||||||
|
params.require(:blocked_domain).permit(:name)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_domain
|
||||||
|
@domain = BlockedDomain.find(params[:id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def blocked_domain_params
|
|
||||||
params.require(:blocked_domain).permit(:name)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_domain
|
|
||||||
@domain = BlockedDomain.find(params[:id])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,84 +1,87 @@
|
||||||
class Admin::CertificatesController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class CertificatesController < BaseController
|
||||||
before_action :set_certificate, :set_api_user, only: [:sign, :show, :download_csr, :download_crt, :revoke, :destroy]
|
load_and_authorize_resource
|
||||||
|
before_action :set_certificate, :set_api_user, only: [:sign, :show, :download_csr, :download_crt, :revoke, :destroy]
|
||||||
|
|
||||||
def show; end
|
def show;
|
||||||
|
end
|
||||||
|
|
||||||
def new
|
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)
|
@certificate = Certificate.new(api_user: @api_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
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]
|
crt = certificate_params[:crt].open.read if certificate_params[:crt]
|
||||||
csr = certificate_params[:csr].open.read if certificate_params[:csr]
|
csr = certificate_params[:csr].open.read if certificate_params[:csr]
|
||||||
|
|
||||||
@certificate = @api_user.certificates.build(csr: csr, crt: crt)
|
@certificate = @api_user.certificates.build(csr: csr, crt: crt)
|
||||||
if @api_user.save
|
if @api_user.save
|
||||||
flash[:notice] = I18n.t('record_created')
|
flash[:notice] = I18n.t('record_created')
|
||||||
|
redirect_to [:admin, @api_user, @certificate]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_create_record')
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
if @certificate.destroy
|
||||||
|
flash[:notice] = I18n.t('record_deleted')
|
||||||
|
redirect_to admin_api_user_path(@api_user)
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_delete_record')
|
||||||
|
render 'show'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def sign
|
||||||
|
if @certificate.sign!
|
||||||
|
flash[:notice] = I18n.t('record_updated')
|
||||||
|
redirect_to [:admin, @api_user, @certificate]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_update_record')
|
||||||
|
render 'show'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def revoke
|
||||||
|
if @certificate.revoke!
|
||||||
|
flash[:notice] = I18n.t('record_updated')
|
||||||
|
else
|
||||||
|
flash[:alert] = I18n.t('failed_to_update_record')
|
||||||
|
end
|
||||||
redirect_to [:admin, @api_user, @certificate]
|
redirect_to [:admin, @api_user, @certificate]
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_create_record')
|
|
||||||
render 'new'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def download_csr
|
||||||
if @certificate.destroy
|
send_data @certificate.csr, filename: "#{@api_user.username}.csr.pem"
|
||||||
flash[:notice] = I18n.t('record_deleted')
|
|
||||||
redirect_to admin_api_user_path(@api_user)
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_delete_record')
|
|
||||||
render 'show'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def sign
|
def download_crt
|
||||||
if @certificate.sign!
|
send_data @certificate.crt, filename: "#{@api_user.username}.crt.pem"
|
||||||
flash[:notice] = I18n.t('record_updated')
|
|
||||||
redirect_to [:admin, @api_user, @certificate]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_update_record')
|
|
||||||
render 'show'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def revoke
|
private
|
||||||
if @certificate.revoke!
|
|
||||||
flash[:notice] = I18n.t('record_updated')
|
def set_certificate
|
||||||
else
|
@certificate = Certificate.find(params[:id])
|
||||||
flash[:alert] = I18n.t('failed_to_update_record')
|
@csr = OpenSSL::X509::Request.new(@certificate.csr) if @certificate.csr
|
||||||
|
@crt = OpenSSL::X509::Certificate.new(@certificate.crt) if @certificate.crt
|
||||||
end
|
end
|
||||||
redirect_to [:admin, @api_user, @certificate]
|
|
||||||
end
|
|
||||||
|
|
||||||
def download_csr
|
def set_api_user
|
||||||
send_data @certificate.csr, filename: "#{@api_user.username}.csr.pem"
|
@api_user = ApiUser.find(params[:api_user_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def download_crt
|
def certificate_params
|
||||||
send_data @certificate.crt, filename: "#{@api_user.username}.crt.pem"
|
if params[:certificate]
|
||||||
end
|
params.require(:certificate).permit(:crt, :csr)
|
||||||
|
else
|
||||||
private
|
{}
|
||||||
|
end
|
||||||
def set_certificate
|
|
||||||
@certificate = Certificate.find(params[:id])
|
|
||||||
@csr = OpenSSL::X509::Request.new(@certificate.csr) if @certificate.csr
|
|
||||||
@crt = OpenSSL::X509::Certificate.new(@certificate.crt) if @certificate.crt
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_api_user
|
|
||||||
@api_user = ApiUser.find(params[:api_user_id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def certificate_params
|
|
||||||
if params[:certificate]
|
|
||||||
params.require(:certificate).permit(:crt, :csr)
|
|
||||||
else
|
|
||||||
{}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,56 +1,57 @@
|
||||||
class Admin::ContactVersionsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class ContactVersionsController < BaseController
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
def index
|
def index
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
|
|
||||||
@q = ContactVersion.search(params[:q])
|
@q = ContactVersion.search(params[:q])
|
||||||
@versions = @q.result.page(params[:page])
|
@versions = @q.result.page(params[:page])
|
||||||
search_params = params[:q].deep_dup
|
search_params = params[:q].deep_dup
|
||||||
|
|
||||||
whereS = "1=1"
|
whereS = "1=1"
|
||||||
|
|
||||||
search_params.each do |key, value|
|
search_params.each do |key, value|
|
||||||
next if value.empty?
|
next if value.empty?
|
||||||
case key
|
case key
|
||||||
when 'event'
|
when 'event'
|
||||||
whereS += " AND event = '#{value}'"
|
whereS += " AND event = '#{value}'"
|
||||||
else
|
else
|
||||||
whereS += create_where_string(key, value)
|
whereS += create_where_string(key, value)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
versions = ContactVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
|
||||||
|
@q = versions.search(params[:q])
|
||||||
|
@versions = @q.result.page(params[:page])
|
||||||
|
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
versions = ContactVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
|
def show
|
||||||
@q = versions.search(params[:q])
|
per_page = 7
|
||||||
@versions = @q.result.page(params[:page])
|
@version = ContactVersion.find(params[:id])
|
||||||
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
@versions = ContactVersion.where(item_id: @version.item_id).order(created_at: :desc, id: :desc)
|
||||||
|
@versions_map = @versions.all.map(&:id)
|
||||||
|
|
||||||
end
|
# what we do is calc amount of results until needed version
|
||||||
|
# then we cacl which page it is
|
||||||
|
if params[:page].blank?
|
||||||
|
counter = @versions_map.index(@version.id) + 1
|
||||||
|
page = counter / per_page
|
||||||
|
page += 1 if (counter % per_page) != 0
|
||||||
|
params[:page] = page
|
||||||
|
end
|
||||||
|
|
||||||
def show
|
@versions = @versions.page(params[:page]).per(per_page)
|
||||||
per_page = 7
|
|
||||||
@version = ContactVersion.find(params[:id])
|
|
||||||
@versions = ContactVersion.where(item_id: @version.item_id).order(created_at: :desc, id: :desc)
|
|
||||||
@versions_map = @versions.all.map(&:id)
|
|
||||||
|
|
||||||
# what we do is calc amount of results until needed version
|
|
||||||
# then we cacl which page it is
|
|
||||||
if params[:page].blank?
|
|
||||||
counter = @versions_map.index(@version.id) + 1
|
|
||||||
page = counter / per_page
|
|
||||||
page += 1 if (counter % per_page) != 0
|
|
||||||
params[:page] = page
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@versions = @versions.page(params[:page]).per(per_page)
|
def search
|
||||||
end
|
render json: ContactVersion.search_by_query(params[:q])
|
||||||
|
end
|
||||||
|
|
||||||
def search
|
def create_where_string(key, value)
|
||||||
render json: ContactVersion.search_by_query(params[:q])
|
" AND object->>'#{key}' ~* '#{value}'"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_where_string(key, value)
|
|
||||||
" AND object->>'#{key}' ~* '#{value}'"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,81 +1,83 @@
|
||||||
class Admin::ContactsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class ContactsController < BaseController
|
||||||
before_action :set_contact, only: [:show]
|
load_and_authorize_resource
|
||||||
|
before_action :set_contact, only: [:show]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
search_params = params[:q].deep_dup
|
search_params = params[:q].deep_dup
|
||||||
|
|
||||||
if search_params[:domain_contacts_type_in].is_a?(Array) && search_params[:domain_contacts_type_in].delete('registrant')
|
if search_params[:domain_contacts_type_in].is_a?(Array) && search_params[:domain_contacts_type_in].delete('registrant')
|
||||||
search_params[:registrant_domains_id_not_null] = 1
|
search_params[:registrant_domains_id_not_null] = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name')
|
||||||
|
contacts = contacts.filter_by_states(params[:statuses_contains].join(',')) if params[:statuses_contains]
|
||||||
|
contacts = contacts.where("ident_country_code is null or ident_country_code=''") if params[:only_no_country_code].eql?('1')
|
||||||
|
|
||||||
|
|
||||||
|
normalize_search_parameters do
|
||||||
|
@q = contacts.search(search_params)
|
||||||
|
@contacts = @q.result.uniq.page(params[:page])
|
||||||
|
end
|
||||||
|
|
||||||
|
@contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name')
|
def search
|
||||||
contacts = contacts.filter_by_states(params[:statuses_contains].join(',')) if params[:statuses_contains]
|
render json: Contact.search_by_query(params[:q])
|
||||||
contacts = contacts.where("ident_country_code is null or ident_country_code=''") if params[:only_no_country_code].eql?('1')
|
|
||||||
|
|
||||||
|
|
||||||
normalize_search_parameters do
|
|
||||||
@q = contacts.search(search_params)
|
|
||||||
@contacts = @q.result.uniq.page(params[:page])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
def edit
|
||||||
end
|
|
||||||
|
|
||||||
def search
|
|
||||||
render json: Contact.search_by_query(params[:q])
|
|
||||||
end
|
|
||||||
|
|
||||||
def edit
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
cp = ignore_empty_statuses
|
|
||||||
|
|
||||||
if @contact.update(cp)
|
|
||||||
flash[:notice] = I18n.t('contact_updated')
|
|
||||||
redirect_to [:admin, @contact]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_update_contact')
|
|
||||||
render 'edit'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_contact
|
|
||||||
@contact = Contact.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def contact_params
|
|
||||||
if params[:contact]
|
|
||||||
params.require(:contact).permit({ statuses: [], status_notes_array: [] })
|
|
||||||
else
|
|
||||||
{ statuses: [] }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def ignore_empty_statuses
|
|
||||||
dp = contact_params
|
|
||||||
dp[:statuses].reject!(&:blank?)
|
|
||||||
dp
|
|
||||||
end
|
|
||||||
|
|
||||||
def normalize_search_parameters
|
|
||||||
ca_cache = params[:q][:created_at_lteq]
|
|
||||||
begin
|
|
||||||
end_time = params[:q][:created_at_lteq].try(:to_date)
|
|
||||||
params[:q][:created_at_lteq] = end_time.try(:end_of_day)
|
|
||||||
# updated at
|
|
||||||
end_time = params[:q][:updated_at_gteq].try(:to_date)
|
|
||||||
params[:q][:updated_at_lteq] = end_time.try(:end_of_day)
|
|
||||||
rescue
|
|
||||||
logger.warn('Invalid date')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
yield
|
def update
|
||||||
|
cp = ignore_empty_statuses
|
||||||
|
|
||||||
params[:q][:created_at_lteq] = ca_cache
|
if @contact.update(cp)
|
||||||
|
flash[:notice] = I18n.t('contact_updated')
|
||||||
|
redirect_to [:admin, @contact]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_update_contact')
|
||||||
|
render 'edit'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_contact
|
||||||
|
@contact = Contact.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def contact_params
|
||||||
|
if params[:contact]
|
||||||
|
params.require(:contact).permit({ statuses: [], status_notes_array: [] })
|
||||||
|
else
|
||||||
|
{ statuses: [] }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def ignore_empty_statuses
|
||||||
|
dp = contact_params
|
||||||
|
dp[:statuses].reject!(&:blank?)
|
||||||
|
dp
|
||||||
|
end
|
||||||
|
|
||||||
|
def normalize_search_parameters
|
||||||
|
ca_cache = params[:q][:created_at_lteq]
|
||||||
|
begin
|
||||||
|
end_time = params[:q][:created_at_lteq].try(:to_date)
|
||||||
|
params[:q][:created_at_lteq] = end_time.try(:end_of_day)
|
||||||
|
# updated at
|
||||||
|
end_time = params[:q][:updated_at_gteq].try(:to_date)
|
||||||
|
params[:q][:updated_at_lteq] = end_time.try(:end_of_day)
|
||||||
|
rescue
|
||||||
|
logger.warn('Invalid date')
|
||||||
|
end
|
||||||
|
|
||||||
|
yield
|
||||||
|
|
||||||
|
params[:q][:created_at_lteq] = ca_cache
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
class Admin::DashboardsController < AdminController
|
module Admin
|
||||||
authorize_resource class: false
|
class DashboardsController < BaseController
|
||||||
|
authorize_resource class: false
|
||||||
|
|
||||||
def show
|
def show
|
||||||
redirect_to [:admin, :domains] if can? :show, Domain
|
redirect_to [:admin, :domains] if can? :show, Domain
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
class Admin::DelayedJobsController < AdminController
|
module Admin
|
||||||
authorize_resource class: false
|
class DelayedJobsController < BaseController
|
||||||
|
authorize_resource class: false
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@jobs = Delayed::Job.all
|
@jobs = Delayed::Job.all
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module Admin
|
module Admin
|
||||||
module DNS
|
module DNS
|
||||||
class ZonesController < AdminController
|
class ZonesController < BaseController
|
||||||
authorize_resource(class: 'DNS::Zone')
|
authorize_resource(class: 'DNS::Zone')
|
||||||
before_action :load_zone, only: %i[edit update destroy]
|
before_action :load_zone, only: %i[edit update destroy]
|
||||||
|
|
||||||
|
|
|
@ -1,75 +1,75 @@
|
||||||
class Admin::DomainVersionsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class DomainVersionsController < BaseController
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
def index
|
def index
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
|
|
||||||
@q = DomainVersion.includes(:item).search(params[:q])
|
@q = DomainVersion.includes(:item).search(params[:q])
|
||||||
@versions = @q.result.page(params[:page])
|
@versions = @q.result.page(params[:page])
|
||||||
search_params = params[:q].deep_dup
|
search_params = params[:q].deep_dup
|
||||||
|
|
||||||
if search_params[:registrant].present?
|
if search_params[:registrant].present?
|
||||||
registrants = Contact.where("name ilike ?", "%#{search_params[:registrant].strip}%")
|
registrants = Contact.where("name ilike ?", "%#{search_params[:registrant].strip}%")
|
||||||
search_params.delete(:registrant)
|
search_params.delete(:registrant)
|
||||||
end
|
|
||||||
|
|
||||||
if search_params[:registrar].present?
|
|
||||||
registrars = Registrar.where("name ilike ?", "%#{search_params[:registrar].strip}%")
|
|
||||||
search_params.delete(:registrar)
|
|
||||||
end
|
|
||||||
|
|
||||||
whereS = "1=1"
|
|
||||||
|
|
||||||
search_params.each do |key, value|
|
|
||||||
next if value.empty?
|
|
||||||
case key
|
|
||||||
when 'event'
|
|
||||||
whereS += " AND event = '#{value}'"
|
|
||||||
when 'name'
|
|
||||||
whereS += " AND (object->>'name' ~* '#{value}' OR object_changes->>'name' ~* '#{value}')"
|
|
||||||
else
|
|
||||||
whereS += create_where_string(key, value)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if search_params[:registrar].present?
|
||||||
|
registrars = Registrar.where("name ilike ?", "%#{search_params[:registrar].strip}%")
|
||||||
|
search_params.delete(:registrar)
|
||||||
|
end
|
||||||
|
|
||||||
|
whereS = "1=1"
|
||||||
|
|
||||||
|
search_params.each do |key, value|
|
||||||
|
next if value.empty?
|
||||||
|
case key
|
||||||
|
when 'event'
|
||||||
|
whereS += " AND event = '#{value}'"
|
||||||
|
when 'name'
|
||||||
|
whereS += " AND (object->>'name' ~* '#{value}' OR object_changes->>'name' ~* '#{value}')"
|
||||||
|
else
|
||||||
|
whereS += create_where_string(key, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
whereS += " AND object->>'registrant_id' IN (#{registrants.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrants.present?
|
||||||
|
whereS += " AND 1=0" if registrants == []
|
||||||
|
whereS += " AND object->>'registrar_id' IN (#{registrars.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrars.present?
|
||||||
|
whereS += " AND 1=0" if registrars == []
|
||||||
|
|
||||||
|
versions = DomainVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
|
||||||
|
@q = versions.search(params[:q])
|
||||||
|
@versions = @q.result.page(params[:page])
|
||||||
|
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
||||||
|
render "admin/domain_versions/archive"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
whereS += " AND object->>'registrant_id' IN (#{registrants.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrants.present?
|
def show
|
||||||
whereS += " AND 1=0" if registrants == []
|
per_page = 7
|
||||||
whereS += " AND object->>'registrar_id' IN (#{registrars.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrars.present?
|
@version = DomainVersion.find(params[:id])
|
||||||
whereS += " AND 1=0" if registrars == []
|
@versions = DomainVersion.where(item_id: @version.item_id).order(created_at: :desc, id: :desc)
|
||||||
|
@versions_map = @versions.all.map(&:id)
|
||||||
|
|
||||||
versions = DomainVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
|
# what we do is calc amount of results until needed version
|
||||||
@q = versions.search(params[:q])
|
# then we cacl which page it is
|
||||||
@versions = @q.result.page(params[:page])
|
if params[:page].blank?
|
||||||
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
counter = @versions_map.index(@version.id) + 1
|
||||||
render "admin/domain_versions/archive"
|
page = counter / per_page
|
||||||
|
page += 1 if (counter % per_page) != 0
|
||||||
|
params[:page] = page
|
||||||
|
end
|
||||||
|
|
||||||
end
|
@versions = @versions.page(params[:page]).per(per_page)
|
||||||
|
|
||||||
def show
|
|
||||||
per_page = 7
|
|
||||||
@version = DomainVersion.find(params[:id])
|
|
||||||
@versions = DomainVersion.where(item_id: @version.item_id).order(created_at: :desc, id: :desc)
|
|
||||||
@versions_map = @versions.all.map(&:id)
|
|
||||||
|
|
||||||
# what we do is calc amount of results until needed version
|
|
||||||
# then we cacl which page it is
|
|
||||||
if params[:page].blank?
|
|
||||||
counter = @versions_map.index(@version.id) + 1
|
|
||||||
page = counter / per_page
|
|
||||||
page += 1 if (counter % per_page) != 0
|
|
||||||
params[:page] = page
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@versions = @versions.page(params[:page]).per(per_page)
|
def search
|
||||||
|
render json: DomainVersion.search_by_query(params[:q])
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_where_string(key, value)
|
||||||
|
" AND object->>'#{key}' ~* '#{value}'"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def search
|
|
||||||
render json: DomainVersion.search_by_query(params[:q])
|
|
||||||
end
|
|
||||||
|
|
||||||
def create_where_string(key, value)
|
|
||||||
" AND object->>'#{key}' ~* '#{value}'"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,133 +1,136 @@
|
||||||
class Admin::DomainsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class DomainsController < BaseController
|
||||||
before_action :set_domain, only: [:show, :edit, :update, :zonefile]
|
load_and_authorize_resource
|
||||||
helper_method :force_delete_templates
|
before_action :set_domain, only: [:show, :edit, :update, :zonefile]
|
||||||
|
helper_method :force_delete_templates
|
||||||
|
|
||||||
# rubocop: disable Metrics/PerceivedComplexity
|
# rubocop: disable Metrics/PerceivedComplexity
|
||||||
# rubocop: disable Metrics/CyclomaticComplexity
|
# rubocop: disable Metrics/CyclomaticComplexity
|
||||||
# rubocop: disable Metrics/AbcSize
|
# rubocop: disable Metrics/AbcSize
|
||||||
def index
|
def index
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
if params[:statuses_contains]
|
if params[:statuses_contains]
|
||||||
domains = Domain.includes(:registrar, :registrant).where(
|
domains = Domain.includes(:registrar, :registrant).where(
|
||||||
"domains.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
"domains.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
domains = Domain.includes(:registrar, :registrant)
|
domains = Domain.includes(:registrar, :registrant)
|
||||||
end
|
end
|
||||||
|
|
||||||
normalize_search_parameters do
|
normalize_search_parameters do
|
||||||
@q = domains.search(params[:q])
|
|
||||||
@domains = @q.result.page(params[:page])
|
|
||||||
if @domains.count == 1 && params[:q][:name_matches].present?
|
|
||||||
redirect_to [:admin, @domains.first] and return
|
|
||||||
elsif @domains.count == 0 && params[:q][:name_matches] !~ /^%.+%$/
|
|
||||||
# if we do not get any results, add wildcards to the name field and search again
|
|
||||||
n_cache = params[:q][:name_matches]
|
|
||||||
params[:q][:name_matches] = "%#{params[:q][:name_matches]}%"
|
|
||||||
@q = domains.search(params[:q])
|
@q = domains.search(params[:q])
|
||||||
@domains = @q.result.page(params[:page])
|
@domains = @q.result.page(params[:page])
|
||||||
params[:q][:name_matches] = n_cache # we don't want to show wildcards in search form
|
if @domains.count == 1 && params[:q][:name_matches].present?
|
||||||
|
redirect_to [:admin, @domains.first] and return
|
||||||
|
elsif @domains.count == 0 && params[:q][:name_matches] !~ /^%.+%$/
|
||||||
|
# if we do not get any results, add wildcards to the name field and search again
|
||||||
|
n_cache = params[:q][:name_matches]
|
||||||
|
params[:q][:name_matches] = "%#{params[:q][:name_matches]}%"
|
||||||
|
@q = domains.search(params[:q])
|
||||||
|
@domains = @q.result.page(params[:page])
|
||||||
|
params[:q][:name_matches] = n_cache # we don't want to show wildcards in search form
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# rubocop: enable Metrics/PerceivedComplexity
|
||||||
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
|
# rubocop: enable Metrics/AbcSize
|
||||||
|
|
||||||
|
def show
|
||||||
|
@domain.valid?
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
build_associations
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
dp = ignore_empty_statuses
|
||||||
|
@domain.is_admin = true
|
||||||
|
@domain.admin_status_update dp[:statuses]
|
||||||
|
|
||||||
|
if @domain.update(dp)
|
||||||
|
flash[:notice] = I18n.t('domain_updated')
|
||||||
|
redirect_to [:admin, @domain]
|
||||||
|
else
|
||||||
|
build_associations
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_update_domain') + ' ' + @domain.errors.full_messages.join(", ")
|
||||||
|
render 'edit'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
def schedule_force_delete
|
||||||
end
|
raise 'Template param cannot be empty' if params[:template_name].blank?
|
||||||
# rubocop: enable Metrics/PerceivedComplexity
|
|
||||||
# rubocop: enable Metrics/CyclomaticComplexity
|
|
||||||
# rubocop: enable Metrics/AbcSize
|
|
||||||
|
|
||||||
def show
|
@domain.transaction do
|
||||||
@domain.valid?
|
@domain.schedule_force_delete
|
||||||
end
|
@domain.registrar.messages.create!(body: I18n.t('force_delete_set_on_domain', domain_name: @domain.name))
|
||||||
|
DomainDeleteForcedEmailJob.enqueue(@domain.id, params[:template_name])
|
||||||
|
end
|
||||||
|
|
||||||
def edit
|
redirect_to edit_admin_domain_path(@domain), notice: t('.scheduled')
|
||||||
build_associations
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
dp = ignore_empty_statuses
|
|
||||||
@domain.is_admin = true
|
|
||||||
@domain.admin_status_update dp[:statuses]
|
|
||||||
|
|
||||||
if @domain.update(dp)
|
|
||||||
flash[:notice] = I18n.t('domain_updated')
|
|
||||||
redirect_to [:admin, @domain]
|
|
||||||
else
|
|
||||||
build_associations
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_update_domain') + ' ' + @domain.errors.full_messages.join(", ")
|
|
||||||
render 'edit'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def schedule_force_delete
|
|
||||||
raise 'Template param cannot be empty' if params[:template_name].blank?
|
|
||||||
|
|
||||||
@domain.transaction do
|
|
||||||
@domain.schedule_force_delete
|
|
||||||
@domain.registrar.messages.create!(body: I18n.t('force_delete_set_on_domain', domain_name: @domain.name))
|
|
||||||
DomainDeleteForcedEmailJob.enqueue(@domain.id, params[:template_name])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to edit_admin_domain_path(@domain), notice: t('.scheduled')
|
def cancel_force_delete
|
||||||
end
|
if @domain.cancel_force_delete
|
||||||
|
flash[:notice] = t('.cancelled')
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_update_domain')
|
||||||
|
end
|
||||||
|
|
||||||
def cancel_force_delete
|
redirect_to edit_admin_domain_path(@domain)
|
||||||
if @domain.cancel_force_delete
|
|
||||||
flash[:notice] = t('.cancelled')
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_update_domain')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to edit_admin_domain_path(@domain)
|
def versions
|
||||||
end
|
@domain = Domain.where(id: params[:domain_id]).includes({ versions: :item }).first
|
||||||
|
@versions = @domain.versions
|
||||||
def versions
|
|
||||||
@domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first
|
|
||||||
@versions = @domain.versions
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_domain
|
|
||||||
@domain = Domain.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def domain_params
|
|
||||||
if params[:domain]
|
|
||||||
params.require(:domain).permit({ statuses: [], status_notes_array: [] })
|
|
||||||
else
|
|
||||||
{ statuses: [] }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def build_associations
|
|
||||||
@server_statuses = @domain.statuses.select { |x| DomainStatus::SERVER_STATUSES.include?(x) }
|
|
||||||
@server_statuses = [nil] if @server_statuses.empty?
|
|
||||||
@other_statuses = @domain.statuses.select { |x| !DomainStatus::SERVER_STATUSES.include?(x) }
|
|
||||||
end
|
|
||||||
|
|
||||||
def ignore_empty_statuses
|
|
||||||
dp = domain_params
|
|
||||||
dp[:statuses].reject!(&:blank?)
|
|
||||||
dp
|
|
||||||
end
|
|
||||||
|
|
||||||
def normalize_search_parameters
|
|
||||||
ca_cache = params[:q][:valid_to_lteq]
|
|
||||||
begin
|
|
||||||
end_time = params[:q][:valid_to_lteq].try(:to_date)
|
|
||||||
params[:q][:valid_to_lteq] = end_time.try(:end_of_day)
|
|
||||||
rescue
|
|
||||||
logger.warn('Invalid date')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
yield
|
private
|
||||||
|
|
||||||
params[:q][:valid_to_lteq] = ca_cache
|
def set_domain
|
||||||
end
|
@domain = Domain.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
def force_delete_templates
|
def domain_params
|
||||||
%w(removed_company death)
|
if params[:domain]
|
||||||
|
params.require(:domain).permit({ statuses: [], status_notes_array: [] })
|
||||||
|
else
|
||||||
|
{ statuses: [] }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_associations
|
||||||
|
@server_statuses = @domain.statuses.select { |x| DomainStatus::SERVER_STATUSES.include?(x) }
|
||||||
|
@server_statuses = [nil] if @server_statuses.empty?
|
||||||
|
@other_statuses = @domain.statuses.select { |x| !DomainStatus::SERVER_STATUSES.include?(x) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def ignore_empty_statuses
|
||||||
|
dp = domain_params
|
||||||
|
dp[:statuses].reject!(&:blank?)
|
||||||
|
dp
|
||||||
|
end
|
||||||
|
|
||||||
|
def normalize_search_parameters
|
||||||
|
ca_cache = params[:q][:valid_to_lteq]
|
||||||
|
begin
|
||||||
|
end_time = params[:q][:valid_to_lteq].try(:to_date)
|
||||||
|
params[:q][:valid_to_lteq] = end_time.try(:end_of_day)
|
||||||
|
rescue
|
||||||
|
logger.warn('Invalid date')
|
||||||
|
end
|
||||||
|
|
||||||
|
yield
|
||||||
|
|
||||||
|
params[:q][:valid_to_lteq] = ca_cache
|
||||||
|
end
|
||||||
|
|
||||||
|
def force_delete_templates
|
||||||
|
%w(removed_company death)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,33 +1,35 @@
|
||||||
class Admin::EppLogsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource class: ApiLog::EppLog
|
class EppLogsController < BaseController
|
||||||
before_action :set_default_dates, only: [:index]
|
load_and_authorize_resource class: ApiLog::EppLog
|
||||||
|
before_action :set_default_dates, only: [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@q = ApiLog::EppLog.search(params[:q])
|
@q = ApiLog::EppLog.search(params[:q])
|
||||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
|
|
||||||
@epp_logs = @q.result
|
@epp_logs = @q.result
|
||||||
@epp_logs = @epp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present?
|
@epp_logs = @epp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present?
|
||||||
@epp_logs = @epp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present?
|
@epp_logs = @epp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present?
|
||||||
@epp_logs = @epp_logs.page(params[:page])
|
@epp_logs = @epp_logs.page(params[:page])
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
@epp_log = ApiLog::EppLog.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_default_dates
|
|
||||||
params[:q] ||= {}
|
|
||||||
|
|
||||||
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
|
||||||
default_date = params[:created_after]
|
|
||||||
|
|
||||||
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
|
||||||
default_date = 'today'
|
|
||||||
end
|
|
||||||
|
|
||||||
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@epp_log = ApiLog::EppLog.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_default_dates
|
||||||
|
params[:q] ||= {}
|
||||||
|
|
||||||
|
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
||||||
|
default_date = params[:created_after]
|
||||||
|
|
||||||
|
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
||||||
|
default_date = 'today'
|
||||||
|
end
|
||||||
|
|
||||||
|
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,73 +1,75 @@
|
||||||
class Admin::InvoicesController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class InvoicesController < BaseController
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
before_action :set_invoice, only: [:forward, :download_pdf]
|
before_action :set_invoice, only: [:forward, :download_pdf]
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@deposit = Deposit.new
|
@deposit = Deposit.new
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
r = Registrar.find_by(id: deposit_params[:registrar_id])
|
|
||||||
@deposit = Deposit.new(deposit_params.merge(registrar: r))
|
|
||||||
@invoice = @deposit.issue_prepayment_invoice
|
|
||||||
|
|
||||||
if @invoice && @invoice.persisted?
|
|
||||||
flash[:notice] = t(:record_created)
|
|
||||||
redirect_to [:admin, @invoice]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = t(:failed_to_create_record)
|
|
||||||
render 'new'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def index
|
def create
|
||||||
@q = Invoice.includes(:account_activity).search(params[:q])
|
r = Registrar.find_by(id: deposit_params[:registrar_id])
|
||||||
@q.sorts = 'number desc' if @q.sorts.empty?
|
@deposit = Deposit.new(deposit_params.merge(registrar: r))
|
||||||
@invoices = @q.result.page(params[:page])
|
@invoice = @deposit.issue_prepayment_invoice
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
if @invoice && @invoice.persisted?
|
||||||
@invoice = Invoice.find(params[:id])
|
flash[:notice] = t(:record_created)
|
||||||
end
|
redirect_to [:admin, @invoice]
|
||||||
|
else
|
||||||
def cancel
|
flash.now[:alert] = t(:failed_to_create_record)
|
||||||
if @invoice.cancel
|
render 'new'
|
||||||
flash[:notice] = t(:record_updated)
|
end
|
||||||
redirect_to([:admin, @invoice])
|
|
||||||
else
|
|
||||||
flash.now[:alert] = t(:failed_to_update_record)
|
|
||||||
render :show
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def forward
|
def index
|
||||||
@invoice.billing_email = @invoice.buyer.billing_email
|
@q = Invoice.includes(:account_activity).search(params[:q])
|
||||||
|
@q.sorts = 'number desc' if @q.sorts.empty?
|
||||||
return unless request.post?
|
@invoices = @q.result.page(params[:page])
|
||||||
|
|
||||||
@invoice.billing_email = params[:invoice][:billing_email]
|
|
||||||
|
|
||||||
if @invoice.forward(render_to_string('registrar/invoices/pdf', layout: false))
|
|
||||||
flash[:notice] = t(:invoice_forwared)
|
|
||||||
redirect_to([:admin, @invoice])
|
|
||||||
else
|
|
||||||
flash.now[:alert] = t(:failed_to_forward_invoice)
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def download_pdf
|
def show
|
||||||
pdf = @invoice.pdf(render_to_string('registrar/invoices/pdf', layout: false))
|
@invoice = Invoice.find(params[:id])
|
||||||
send_data pdf, filename: @invoice.pdf_name
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
def cancel
|
||||||
|
if @invoice.cancel
|
||||||
|
flash[:notice] = t(:record_updated)
|
||||||
|
redirect_to([:admin, @invoice])
|
||||||
|
else
|
||||||
|
flash.now[:alert] = t(:failed_to_update_record)
|
||||||
|
render :show
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def deposit_params
|
def forward
|
||||||
params.require(:deposit).permit(:amount, :description, :registrar_id)
|
@invoice.billing_email = @invoice.buyer.billing_email
|
||||||
end
|
|
||||||
|
|
||||||
def set_invoice
|
return unless request.post?
|
||||||
@invoice = Invoice.find(params[:invoice_id])
|
|
||||||
|
@invoice.billing_email = params[:invoice][:billing_email]
|
||||||
|
|
||||||
|
if @invoice.forward(render_to_string('registrar/invoices/pdf', layout: false))
|
||||||
|
flash[:notice] = t(:invoice_forwared)
|
||||||
|
redirect_to([:admin, @invoice])
|
||||||
|
else
|
||||||
|
flash.now[:alert] = t(:failed_to_forward_invoice)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def download_pdf
|
||||||
|
pdf = @invoice.pdf(render_to_string('registrar/invoices/pdf', layout: false))
|
||||||
|
send_data pdf, filename: @invoice.pdf_name
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def deposit_params
|
||||||
|
params.require(:deposit).permit(:amount, :description, :registrar_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_invoice
|
||||||
|
@invoice = Invoice.find(params[:invoice_id])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
class Admin::KeyrelaysController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class KeyrelaysController < BaseController
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@q = Keyrelay.includes(:requester, :accepter).search(params[:q])
|
@q = Keyrelay.includes(:requester, :accepter).search(params[:q])
|
||||||
@keyrelays = @q.result.page(params[:page])
|
@keyrelays = @q.result.page(params[:page])
|
||||||
|
end
|
||||||
|
|
||||||
|
def show;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show; end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
class Admin::LegalDocumentsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class LegalDocumentsController < BaseController
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@ld = LegalDocument.find(params[:id])
|
@ld = LegalDocument.find(params[:id])
|
||||||
filename = @ld.path.split('/').last
|
filename = @ld.path.split('/').last
|
||||||
send_data File.open(@ld.path).read, filename: filename
|
send_data File.open(@ld.path).read, filename: filename
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,61 +1,63 @@
|
||||||
class Admin::MailTemplatesController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class MailTemplatesController < BaseController
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@q = MailTemplate.search(params[:q])
|
@q = MailTemplate.search(params[:q])
|
||||||
@mail_templates = @q.result.page(params[:page])
|
@mail_templates = @q.result.page(params[:page])
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
@mail_tempalte = MailTemplate.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
@mail_template = MailTemplate.find(params[:id])
|
|
||||||
@subject = Liquid::Template.parse(@mail_template.subject).render.html_safe
|
|
||||||
@html_body = Liquid::Template.parse(@mail_template.body).render.html_safe
|
|
||||||
@text_body = Liquid::Template.parse(@mail_template.text_body).render.html_safe
|
|
||||||
end
|
|
||||||
|
|
||||||
def edit
|
|
||||||
@mail_template = MailTemplate.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@mail_template = MailTemplate.new(mail_template_params)
|
|
||||||
|
|
||||||
if @mail_template.save
|
|
||||||
redirect_to [:admin, @mail_template]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t(:failure)
|
|
||||||
render 'new'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
def new
|
||||||
@mail_template = MailTemplate.find(params[:id])
|
@mail_tempalte = MailTemplate.new
|
||||||
|
|
||||||
if @mail_template.update_attributes(mail_template_params)
|
|
||||||
redirect_to [:admin, @mail_template]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t(:failure)
|
|
||||||
render 'edit'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def show
|
||||||
@mail_template = MailTemplate.find(params[:id])
|
@mail_template = MailTemplate.find(params[:id])
|
||||||
if @mail_template.destroy
|
@subject = Liquid::Template.parse(@mail_template.subject).render.html_safe
|
||||||
redirect_to admin_mail_templates_path, notise: t(:deleted)
|
@html_body = Liquid::Template.parse(@mail_template.body).render.html_safe
|
||||||
else
|
@text_body = Liquid::Template.parse(@mail_template.text_body).render.html_safe
|
||||||
flash.now[:alert] = I18n.t(:failure)
|
|
||||||
render 'show'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
def edit
|
||||||
|
@mail_template = MailTemplate.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
def mail_template_params
|
def create
|
||||||
params.require(:mail_template).permit(:name, :subject, :from, :bcc, :cc, :body, :text_body)
|
@mail_template = MailTemplate.new(mail_template_params)
|
||||||
|
|
||||||
|
if @mail_template.save
|
||||||
|
redirect_to [:admin, @mail_template]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t(:failure)
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@mail_template = MailTemplate.find(params[:id])
|
||||||
|
|
||||||
|
if @mail_template.update_attributes(mail_template_params)
|
||||||
|
redirect_to [:admin, @mail_template]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t(:failure)
|
||||||
|
render 'edit'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@mail_template = MailTemplate.find(params[:id])
|
||||||
|
if @mail_template.destroy
|
||||||
|
redirect_to admin_mail_templates_path, notise: t(:deleted)
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t(:failure)
|
||||||
|
render 'show'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def mail_template_params
|
||||||
|
params.require(:mail_template).permit(:name, :subject, :from, :bcc, :cc, :body, :text_body)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,42 +1,44 @@
|
||||||
class Admin::PendingDeletesController < AdminController
|
module Admin
|
||||||
before_action :find_domain
|
class PendingDeletesController < BaseController
|
||||||
before_action :check_status
|
before_action :find_domain
|
||||||
|
before_action :check_status
|
||||||
|
|
||||||
def update
|
def update
|
||||||
authorize! :update, :pending
|
authorize! :update, :pending
|
||||||
|
|
||||||
if registrant_verification.domain_registrant_delete_confirm!("admin #{current_user.username}")
|
if registrant_verification.domain_registrant_delete_confirm!("admin #{current_user.username}")
|
||||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
||||||
else
|
else
|
||||||
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
authorize! :destroy, :pending
|
authorize! :destroy, :pending
|
||||||
|
|
||||||
if registrant_verification.domain_registrant_delete_reject!("admin #{current_user.username}")
|
if registrant_verification.domain_registrant_delete_reject!("admin #{current_user.username}")
|
||||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
|
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
|
||||||
else
|
else
|
||||||
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def registrant_verification
|
def registrant_verification
|
||||||
# steal token
|
# steal token
|
||||||
token = @domain.registrant_verification_token
|
token = @domain.registrant_verification_token
|
||||||
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
|
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
|
||||||
domain_name: @domain.name,
|
domain_name: @domain.name,
|
||||||
verification_token: token)
|
verification_token: token)
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_domain
|
def find_domain
|
||||||
@domain = Domain.find(params[:domain_id])
|
@domain = Domain.find(params[:domain_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_status
|
def check_status
|
||||||
return redirect_to admin_domain_path(@domain.id), alert: t(:something_wrong) unless @domain.pending_delete?
|
return redirect_to admin_domain_path(@domain.id), alert: t(:something_wrong) unless @domain.pending_delete?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,41 +1,43 @@
|
||||||
class Admin::PendingUpdatesController < AdminController
|
module Admin
|
||||||
before_action :find_domain
|
class PendingUpdatesController < BaseController
|
||||||
before_action :check_status
|
before_action :find_domain
|
||||||
|
before_action :check_status
|
||||||
|
|
||||||
def update
|
def update
|
||||||
authorize! :update, :pending
|
authorize! :update, :pending
|
||||||
|
|
||||||
if registrant_verification.domain_registrant_change_confirm!("admin #{current_user.username}")
|
if registrant_verification.domain_registrant_change_confirm!("admin #{current_user.username}")
|
||||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
||||||
else
|
else
|
||||||
redirect_to edit_admin_domain_path(@domain.id), alert: t(:failure)
|
redirect_to edit_admin_domain_path(@domain.id), alert: t(:failure)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
authorize! :destroy, :pending
|
authorize! :destroy, :pending
|
||||||
if registrant_verification.domain_registrant_change_reject!("admin #{current_user.username}")
|
if registrant_verification.domain_registrant_change_reject!("admin #{current_user.username}")
|
||||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
|
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
|
||||||
else
|
else
|
||||||
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def registrant_verification
|
def registrant_verification
|
||||||
# steal token
|
# steal token
|
||||||
token = @domain.registrant_verification_token
|
token = @domain.registrant_verification_token
|
||||||
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
|
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
|
||||||
domain_name: @domain.name,
|
domain_name: @domain.name,
|
||||||
verification_token: token)
|
verification_token: token)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_domain
|
def find_domain
|
||||||
@domain = Domain.find(params[:domain_id])
|
@domain = Domain.find(params[:domain_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_status
|
def check_status
|
||||||
return redirect_to admin_domain_path(@domain.id), alert: t(:something_wrong) unless @domain.pending_update?
|
return redirect_to admin_domain_path(@domain.id), alert: t(:something_wrong) unless @domain.pending_update?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,68 +1,72 @@
|
||||||
class Admin::RegistrarsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class RegistrarsController < BaseController
|
||||||
before_action :set_registrar, only: [:show, :edit, :update, :destroy]
|
load_and_authorize_resource
|
||||||
def search
|
before_action :set_registrar, only: [:show, :edit, :update, :destroy]
|
||||||
render json: Registrar.search_by_query(params[:q])
|
|
||||||
end
|
|
||||||
|
|
||||||
def index
|
def search
|
||||||
@q = Registrar.joins(:accounts).ordered.search(params[:q])
|
render json: Registrar.search_by_query(params[:q])
|
||||||
@registrars = @q.result.page(params[:page])
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
def index
|
||||||
@registrar = Registrar.new
|
@q = Registrar.joins(:accounts).ordered.search(params[:q])
|
||||||
end
|
@registrars = @q.result.page(params[:page])
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def new
|
||||||
@registrar = Registrar.new(registrar_params)
|
@registrar = Registrar.new
|
||||||
|
end
|
||||||
|
|
||||||
begin
|
def create
|
||||||
@registrar.transaction do
|
@registrar = Registrar.new(registrar_params)
|
||||||
@registrar.save!
|
|
||||||
@registrar.accounts.create!(account_type: Account::CASH, currency: 'EUR')
|
begin
|
||||||
|
@registrar.transaction do
|
||||||
|
@registrar.save!
|
||||||
|
@registrar.accounts.create!(account_type: Account::CASH, currency: 'EUR')
|
||||||
|
end
|
||||||
|
|
||||||
|
flash[:notice] = t('.created')
|
||||||
|
redirect_to [:admin, @registrar]
|
||||||
|
rescue ActiveRecord::RecordInvalid
|
||||||
|
flash.now[:alert] = t('.not_created')
|
||||||
|
render 'new'
|
||||||
end
|
end
|
||||||
|
|
||||||
flash[:notice] = t('.created')
|
|
||||||
redirect_to [:admin, @registrar]
|
|
||||||
rescue ActiveRecord::RecordInvalid
|
|
||||||
flash.now[:alert] = t('.not_created')
|
|
||||||
render 'new'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def edit; end
|
def edit;
|
||||||
|
|
||||||
def update
|
|
||||||
if @registrar.update(registrar_params)
|
|
||||||
flash[:notice] = t('.updated')
|
|
||||||
redirect_to [:admin, @registrar]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = t('.not_updated')
|
|
||||||
render 'edit'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def update
|
||||||
if @registrar.destroy
|
if @registrar.update(registrar_params)
|
||||||
flash[:notice] = I18n.t('registrar_deleted')
|
flash[:notice] = t('.updated')
|
||||||
redirect_to admin_registrars_path
|
redirect_to [:admin, @registrar]
|
||||||
else
|
else
|
||||||
flash.now[:alert] = I18n.t('failed_to_delete_registrar')
|
flash.now[:alert] = t('.not_updated')
|
||||||
render 'show'
|
render 'edit'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
def destroy
|
||||||
|
if @registrar.destroy
|
||||||
|
flash[:notice] = I18n.t('registrar_deleted')
|
||||||
|
redirect_to admin_registrars_path
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_delete_registrar')
|
||||||
|
render 'show'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def set_registrar
|
private
|
||||||
@registrar = Registrar.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def registrar_params
|
def set_registrar
|
||||||
params.require(:registrar).permit(
|
@registrar = Registrar.find(params[:id])
|
||||||
:name, :reg_no, :vat_no, :street, :city, :state, :zip, :billing_address,
|
end
|
||||||
:country_code, :email, :phone, :website, :billing_email, :code, :test_registrar
|
|
||||||
)
|
def registrar_params
|
||||||
|
params.require(:registrar).permit(
|
||||||
|
:name, :reg_no, :vat_no, :street, :city, :state, :zip, :billing_address,
|
||||||
|
:country_code, :email, :phone, :website, :billing_email, :code, :test_registrar
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,34 +1,36 @@
|
||||||
class Admin::ReppLogsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource class: ApiLog::ReppLog
|
class ReppLogsController < BaseController
|
||||||
before_action :set_default_dates, only: [:index]
|
load_and_authorize_resource class: ApiLog::ReppLog
|
||||||
|
before_action :set_default_dates, only: [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@q = ApiLog::ReppLog.search(params[:q])
|
@q = ApiLog::ReppLog.search(params[:q])
|
||||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
|
|
||||||
@repp_logs = @q.result
|
@repp_logs = @q.result
|
||||||
@repp_logs = @repp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present?
|
@repp_logs = @repp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present?
|
||||||
@repp_logs = @repp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present?
|
@repp_logs = @repp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present?
|
||||||
@repp_logs = @repp_logs.page(params[:page])
|
@repp_logs = @repp_logs.page(params[:page])
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
@repp_log = ApiLog::ReppLog.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_default_dates
|
|
||||||
params[:q] ||= {}
|
|
||||||
|
|
||||||
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
|
||||||
|
|
||||||
default_date = params[:created_after]
|
|
||||||
|
|
||||||
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
|
||||||
default_date = 'today'
|
|
||||||
end
|
|
||||||
|
|
||||||
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@repp_log = ApiLog::ReppLog.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_default_dates
|
||||||
|
params[:q] ||= {}
|
||||||
|
|
||||||
|
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
||||||
|
|
||||||
|
default_date = params[:created_after]
|
||||||
|
|
||||||
|
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
||||||
|
default_date = 'today'
|
||||||
|
end
|
||||||
|
|
||||||
|
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,68 +1,70 @@
|
||||||
class Admin::ReservedDomainsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class ReservedDomainsController < BaseController
|
||||||
before_action :set_domain, only: [:edit, :update]
|
load_and_authorize_resource
|
||||||
|
before_action :set_domain, only: [:edit, :update]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
domains = ReservedDomain.all.order(:name)
|
domains = ReservedDomain.all.order(:name)
|
||||||
@q = domains.search(params[:q])
|
@q = domains.search(params[:q])
|
||||||
@domains = @q.result.page(params[:page])
|
@domains = @q.result.page(params[:page])
|
||||||
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
@domain = ReservedDomain.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def edit
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
|
|
||||||
@domain = ReservedDomain.new(reserved_domain_params)
|
|
||||||
|
|
||||||
if @domain.save
|
|
||||||
flash[:notice] = I18n.t('domain_added')
|
|
||||||
redirect_to admin_reserved_domains_path
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_add_domain')
|
|
||||||
render 'new'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
def new
|
||||||
|
@domain = ReservedDomain.new
|
||||||
def update
|
|
||||||
|
|
||||||
if @domain.update(reserved_domain_params)
|
|
||||||
flash[:notice] = I18n.t('domain_updated')
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_update_domain')
|
|
||||||
end
|
|
||||||
render 'edit'
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def delete
|
|
||||||
|
|
||||||
if ReservedDomain.find(params[:id]).destroy
|
|
||||||
flash[:notice] = I18n.t('domain_deleted')
|
|
||||||
redirect_to admin_reserved_domains_path
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_delete_domain')
|
|
||||||
redirect_to admin_reserved_domains_path
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
private
|
def create
|
||||||
|
|
||||||
def reserved_domain_params
|
@domain = ReservedDomain.new(reserved_domain_params)
|
||||||
params.require(:reserved_domain).permit(:name, :password)
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_domain
|
if @domain.save
|
||||||
@domain = ReservedDomain.find(params[:id])
|
flash[:notice] = I18n.t('domain_added')
|
||||||
|
redirect_to admin_reserved_domains_path
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_add_domain')
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
|
||||||
|
if @domain.update(reserved_domain_params)
|
||||||
|
flash[:notice] = I18n.t('domain_updated')
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_update_domain')
|
||||||
|
end
|
||||||
|
render 'edit'
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete
|
||||||
|
|
||||||
|
if ReservedDomain.find(params[:id]).destroy
|
||||||
|
flash[:notice] = I18n.t('domain_deleted')
|
||||||
|
redirect_to admin_reserved_domains_path
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_delete_domain')
|
||||||
|
redirect_to admin_reserved_domains_path
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def reserved_domain_params
|
||||||
|
params.require(:reserved_domain).permit(:name, :password)
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_domain
|
||||||
|
@domain = ReservedDomain.find(params[:id])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,26 +1,28 @@
|
||||||
class Admin::SessionsController < Devise::SessionsController
|
module Admin
|
||||||
skip_authorization_check only: :create
|
class SessionsController < Devise::SessionsController
|
||||||
|
skip_authorization_check only: :create
|
||||||
|
|
||||||
def login
|
def login
|
||||||
@admin_user = AdminUser.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
if params[:admin_user].blank?
|
|
||||||
@admin_user = AdminUser.new
|
@admin_user = AdminUser.new
|
||||||
flash[:alert] = 'Something went wrong'
|
|
||||||
return render 'login'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@admin_user = AdminUser.find_by(username: params[:admin_user][:username])
|
def create
|
||||||
@admin_user ||= AdminUser.new(username: params[:admin_user][:username])
|
if params[:admin_user].blank?
|
||||||
|
@admin_user = AdminUser.new
|
||||||
|
flash[:alert] = 'Something went wrong'
|
||||||
|
return render 'login'
|
||||||
|
end
|
||||||
|
|
||||||
if @admin_user.valid_password?(params[:admin_user][:password])
|
@admin_user = AdminUser.find_by(username: params[:admin_user][:username])
|
||||||
sign_in @admin_user, event: :authentication
|
@admin_user ||= AdminUser.new(username: params[:admin_user][:username])
|
||||||
redirect_to admin_root_url, notice: I18n.t(:welcome)
|
|
||||||
else
|
if @admin_user.valid_password?(params[:admin_user][:password])
|
||||||
flash[:alert] = 'Authorization error'
|
sign_in @admin_user, event: :authentication
|
||||||
render 'login'
|
redirect_to admin_root_url, notice: I18n.t(:welcome)
|
||||||
|
else
|
||||||
|
flash[:alert] = 'Authorization error'
|
||||||
|
render 'login'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,95 +1,98 @@
|
||||||
class Admin::SettingsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class SettingsController < BaseController
|
||||||
before_action :set_setting_group, only: [:show, :update]
|
load_and_authorize_resource
|
||||||
|
before_action :set_setting_group, only: [:show, :update]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@settings = Setting.unscoped
|
@settings = Setting.unscoped
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@errors = Setting.params_errors(casted_settings)
|
@errors = Setting.params_errors(casted_settings)
|
||||||
if @errors.empty?
|
if @errors.empty?
|
||||||
casted_settings.each do |k, v|
|
casted_settings.each do |k, v|
|
||||||
Setting[k] = v
|
Setting[k] = v
|
||||||
|
end
|
||||||
|
|
||||||
|
flash[:notice] = I18n.t('records_updated')
|
||||||
|
redirect_to [:admin, :settings]
|
||||||
|
else
|
||||||
|
flash[:alert] = @errors.values.uniq.join(", ")
|
||||||
|
render "admin/settings/index"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def show;
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
if @setting_group.update(setting_group_params)
|
||||||
|
flash[:notice] = I18n.t('setting_updated')
|
||||||
|
redirect_to [:admin, @setting_group]
|
||||||
|
else
|
||||||
|
flash[:alert] = I18n.t('failed_to_update_setting')
|
||||||
|
render 'show'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_setting_group
|
||||||
|
@setting_group = SettingGroup.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def setting_group_params
|
||||||
|
params.require(:setting_group).permit(settings_attributes: [:value, :id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def casted_settings # rubocop:disable Metrics/MethodLength
|
||||||
|
settings = {}
|
||||||
|
|
||||||
|
ints = [
|
||||||
|
:admin_contacts_min_count,
|
||||||
|
:admin_contacts_max_count,
|
||||||
|
:tech_contacts_min_count,
|
||||||
|
:tech_contacts_max_count,
|
||||||
|
:orphans_contacts_in_months,
|
||||||
|
:ds_digest_type,
|
||||||
|
:dnskeys_min_count,
|
||||||
|
:dnskeys_max_count,
|
||||||
|
:ns_min_count,
|
||||||
|
:ns_max_count,
|
||||||
|
:transfer_wait_time,
|
||||||
|
:invoice_number_min,
|
||||||
|
:invoice_number_max,
|
||||||
|
:days_to_keep_business_registry_cache,
|
||||||
|
:days_to_keep_invoices_active,
|
||||||
|
:days_to_keep_overdue_invoices_active,
|
||||||
|
:days_to_renew_domain_before_expire,
|
||||||
|
:expire_warning_period,
|
||||||
|
:redemption_grace_period,
|
||||||
|
:expire_pending_confirmation
|
||||||
|
]
|
||||||
|
|
||||||
|
floats = [:registry_vat_prc, :minimum_deposit]
|
||||||
|
|
||||||
|
booleans = [
|
||||||
|
:ds_data_allowed,
|
||||||
|
:key_data_allowed,
|
||||||
|
:client_side_status_editing_enabled,
|
||||||
|
:registrar_ip_whitelist_enabled,
|
||||||
|
:api_ip_whitelist_enabled,
|
||||||
|
:request_confrimation_on_registrant_change_enabled,
|
||||||
|
:request_confirmation_on_domain_deletion_enabled,
|
||||||
|
:nameserver_required,
|
||||||
|
:address_processing
|
||||||
|
]
|
||||||
|
|
||||||
|
params[:settings].each do |k, v|
|
||||||
|
settings[k] = v
|
||||||
|
settings[k] = v.to_i if ints.include?(k.to_sym)
|
||||||
|
settings[k] = v.to_f if floats.include?(k.to_sym)
|
||||||
|
settings[k] = (v == 'true' ? true : false) if booleans.include?(k.to_sym)
|
||||||
end
|
end
|
||||||
|
|
||||||
flash[:notice] = I18n.t('records_updated')
|
settings
|
||||||
redirect_to [:admin, :settings]
|
|
||||||
else
|
|
||||||
flash[:alert] = @errors.values.uniq.join(", ")
|
|
||||||
render "admin/settings/index"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show; end
|
|
||||||
|
|
||||||
def update
|
|
||||||
if @setting_group.update(setting_group_params)
|
|
||||||
flash[:notice] = I18n.t('setting_updated')
|
|
||||||
redirect_to [:admin, @setting_group]
|
|
||||||
else
|
|
||||||
flash[:alert] = I18n.t('failed_to_update_setting')
|
|
||||||
render 'show'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_setting_group
|
|
||||||
@setting_group = SettingGroup.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def setting_group_params
|
|
||||||
params.require(:setting_group).permit(settings_attributes: [:value, :id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def casted_settings # rubocop:disable Metrics/MethodLength
|
|
||||||
settings = {}
|
|
||||||
|
|
||||||
ints = [
|
|
||||||
:admin_contacts_min_count,
|
|
||||||
:admin_contacts_max_count,
|
|
||||||
:tech_contacts_min_count,
|
|
||||||
:tech_contacts_max_count,
|
|
||||||
:orphans_contacts_in_months,
|
|
||||||
:ds_digest_type,
|
|
||||||
:dnskeys_min_count,
|
|
||||||
:dnskeys_max_count,
|
|
||||||
:ns_min_count,
|
|
||||||
:ns_max_count,
|
|
||||||
:transfer_wait_time,
|
|
||||||
:invoice_number_min,
|
|
||||||
:invoice_number_max,
|
|
||||||
:days_to_keep_business_registry_cache,
|
|
||||||
:days_to_keep_invoices_active,
|
|
||||||
:days_to_keep_overdue_invoices_active,
|
|
||||||
:days_to_renew_domain_before_expire,
|
|
||||||
:expire_warning_period,
|
|
||||||
:redemption_grace_period,
|
|
||||||
:expire_pending_confirmation
|
|
||||||
]
|
|
||||||
|
|
||||||
floats = [:registry_vat_prc, :minimum_deposit]
|
|
||||||
|
|
||||||
booleans = [
|
|
||||||
:ds_data_allowed,
|
|
||||||
:key_data_allowed,
|
|
||||||
:client_side_status_editing_enabled,
|
|
||||||
:registrar_ip_whitelist_enabled,
|
|
||||||
:api_ip_whitelist_enabled,
|
|
||||||
:request_confrimation_on_registrant_change_enabled,
|
|
||||||
:request_confirmation_on_domain_deletion_enabled,
|
|
||||||
:nameserver_required,
|
|
||||||
:address_processing
|
|
||||||
]
|
|
||||||
|
|
||||||
params[:settings].each do |k, v|
|
|
||||||
settings[k] = v
|
|
||||||
settings[k] = v.to_i if ints.include?(k.to_sym)
|
|
||||||
settings[k] = v.to_f if floats.include?(k.to_sym)
|
|
||||||
settings[k] = (v == 'true' ? true : false) if booleans.include?(k.to_sym)
|
|
||||||
end
|
|
||||||
|
|
||||||
settings
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,56 +1,60 @@
|
||||||
class Admin::WhiteIpsController < AdminController
|
module Admin
|
||||||
load_and_authorize_resource
|
class WhiteIpsController < BaseController
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
before_action :set_registrar, only: [:new, :show, :edit, :destroy, :update]
|
before_action :set_registrar, only: [:new, :show, :edit, :destroy, :update]
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@white_ip = WhiteIp.new(registrar: @registrar)
|
@white_ip = WhiteIp.new(registrar: @registrar)
|
||||||
end
|
|
||||||
|
|
||||||
def show; end
|
|
||||||
|
|
||||||
def edit; end
|
|
||||||
|
|
||||||
def destroy
|
|
||||||
if @white_ip.destroy
|
|
||||||
flash[:notice] = I18n.t('record_deleted')
|
|
||||||
redirect_to admin_registrar_path(@registrar)
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_delete_record')
|
|
||||||
render 'show'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
def show;
|
||||||
@white_ip = WhiteIp.new(white_ip_params)
|
|
||||||
@registrar = @white_ip.registrar
|
|
||||||
|
|
||||||
if @white_ip.save
|
|
||||||
flash[:notice] = I18n.t('record_created')
|
|
||||||
redirect_to [:admin, @registrar, @white_ip]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_create_record')
|
|
||||||
render 'new'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
def edit;
|
||||||
if @white_ip.update(white_ip_params)
|
|
||||||
flash[:notice] = I18n.t('record_updated')
|
|
||||||
redirect_to [:admin, @registrar, @white_ip]
|
|
||||||
else
|
|
||||||
flash.now[:alert] = I18n.t('failed_to_update_record')
|
|
||||||
render 'edit'
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
def destroy
|
||||||
|
if @white_ip.destroy
|
||||||
|
flash[:notice] = I18n.t('record_deleted')
|
||||||
|
redirect_to admin_registrar_path(@registrar)
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_delete_record')
|
||||||
|
render 'show'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def set_registrar
|
def create
|
||||||
@registrar = Registrar.find_by(id: params[:registrar_id])
|
@white_ip = WhiteIp.new(white_ip_params)
|
||||||
end
|
@registrar = @white_ip.registrar
|
||||||
|
|
||||||
def white_ip_params
|
if @white_ip.save
|
||||||
params.require(:white_ip).permit(:ipv4, :ipv6, :registrar_id, { interfaces: [] })
|
flash[:notice] = I18n.t('record_created')
|
||||||
|
redirect_to [:admin, @registrar, @white_ip]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_create_record')
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
if @white_ip.update(white_ip_params)
|
||||||
|
flash[:notice] = I18n.t('record_updated')
|
||||||
|
redirect_to [:admin, @registrar, @white_ip]
|
||||||
|
else
|
||||||
|
flash.now[:alert] = I18n.t('failed_to_update_record')
|
||||||
|
render 'edit'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_registrar
|
||||||
|
@registrar = Registrar.find_by(id: params[:registrar_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def white_ip_params
|
||||||
|
params.require(:white_ip).permit(:ipv4, :ipv6, :registrar_id, { interfaces: [] })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
class Admin::ZonefilesController < ApplicationController
|
module Admin
|
||||||
authorize_resource class: false
|
class ZonefilesController < BaseController
|
||||||
# TODO: Refactor this
|
authorize_resource class: false
|
||||||
|
# TODO: Refactor this
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if DNS::Zone.origins.include?(params[:origin])
|
if DNS::Zone.origins.include?(params[:origin])
|
||||||
|
|
||||||
@zonefile = ActiveRecord::Base.connection.execute(
|
@zonefile = ActiveRecord::Base.connection.execute(
|
||||||
"select generate_zonefile('#{params[:origin]}')"
|
"select generate_zonefile('#{params[:origin]}')"
|
||||||
)[0]['generate_zonefile']
|
)[0]['generate_zonefile']
|
||||||
|
|
||||||
send_data @zonefile, filename: "#{params[:origin]}.txt"
|
send_data @zonefile, filename: "#{params[:origin]}.txt"
|
||||||
else
|
else
|
||||||
flash[:alert] = 'Origin not supported'
|
flash[:alert] = 'Origin not supported'
|
||||||
redirect_to :back
|
redirect_to :back
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
class AdminController < ApplicationController
|
|
||||||
before_action :authenticate_user!
|
|
||||||
|
|
||||||
helper_method :head_title_sufix
|
|
||||||
def head_title_sufix
|
|
||||||
t(:admin_head_title_sufix)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -52,11 +52,6 @@
|
||||||
<ellipse fill="none" stroke="black" cx="532" cy="-462" rx="87.9851" ry="18"/>
|
<ellipse fill="none" stroke="black" cx="532" cy="-462" rx="87.9851" ry="18"/>
|
||||||
<text text-anchor="middle" x="532" y="-458.3" font-family="Times,serif" font-size="14.00">Epp::ErrorsController</text>
|
<text text-anchor="middle" x="532" y="-458.3" font-family="Times,serif" font-size="14.00">Epp::ErrorsController</text>
|
||||||
</g>
|
</g>
|
||||||
<!-- AdminController -->
|
|
||||||
<g id="node9" class="node"><title>AdminController</title>
|
|
||||||
<ellipse fill="none" stroke="black" cx="-361" cy="66" rx="71.4873" ry="18"/>
|
|
||||||
<text text-anchor="middle" x="-361" y="69.7" font-family="Times,serif" font-size="14.00">AdminController</text>
|
|
||||||
</g>
|
|
||||||
<!-- RegistrarController -->
|
<!-- RegistrarController -->
|
||||||
<g id="node10" class="node"><title>RegistrarController</title>
|
<g id="node10" class="node"><title>RegistrarController</title>
|
||||||
<ellipse fill="none" stroke="black" cx="-173" cy="-462" rx="79.0865" ry="18"/>
|
<ellipse fill="none" stroke="black" cx="-173" cy="-462" rx="79.0865" ry="18"/>
|
||||||
|
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
@ -131,16 +131,6 @@
|
||||||
<polyline fill="none" stroke="black" points="740.5,56 875.5,56 "/>
|
<polyline fill="none" stroke="black" points="740.5,56 875.5,56 "/>
|
||||||
<text text-anchor="start" x="748.5" y="71.2" font-family="Times,serif" font-size="14.00">_layout</text>
|
<text text-anchor="start" x="748.5" y="71.2" font-family="Times,serif" font-size="14.00">_layout</text>
|
||||||
</g>
|
</g>
|
||||||
<!-- AdminController -->
|
|
||||||
<g id="node9" class="node"><title>AdminController</title>
|
|
||||||
<path fill="none" stroke="black" d="M152,239.5C152,239.5 238,239.5 238,239.5 244,239.5 250,233.5 250,227.5 250,227.5 250,158.5 250,158.5 250,152.5 244,146.5 238,146.5 238,146.5 152,146.5 152,146.5 146,146.5 140,152.5 140,158.5 140,158.5 140,227.5 140,227.5 140,233.5 146,239.5 152,239.5"/>
|
|
||||||
<text text-anchor="middle" x="195" y="161.7" font-family="Times,serif" font-size="14.00">AdminController</text>
|
|
||||||
<polyline fill="none" stroke="black" points="140,169.5 250,169.5 "/>
|
|
||||||
<text text-anchor="start" x="148" y="184.7" font-family="Times,serif" font-size="14.00">head_title_sufix</text>
|
|
||||||
<polyline fill="none" stroke="black" points="140,192.5 250,192.5 "/>
|
|
||||||
<polyline fill="none" stroke="black" points="140,216.5 250,216.5 "/>
|
|
||||||
<text text-anchor="start" x="148" y="231.7" font-family="Times,serif" font-size="14.00">_layout</text>
|
|
||||||
</g>
|
|
||||||
<!-- RegistrarController -->
|
<!-- RegistrarController -->
|
||||||
<g id="node10" class="node"><title>RegistrarController</title>
|
<g id="node10" class="node"><title>RegistrarController</title>
|
||||||
<path fill="none" stroke="black" d="M-708,539.5C-708,539.5 -610,539.5 -610,539.5 -604,539.5 -598,533.5 -598,527.5 -598,527.5 -598,428.5 -598,428.5 -598,422.5 -604,416.5 -610,416.5 -610,416.5 -708,416.5 -708,416.5 -714,416.5 -720,422.5 -720,428.5 -720,428.5 -720,527.5 -720,527.5 -720,533.5 -714,539.5 -708,539.5"/>
|
<path fill="none" stroke="black" d="M-708,539.5C-708,539.5 -610,539.5 -610,539.5 -604,539.5 -598,533.5 -598,527.5 -598,527.5 -598,428.5 -598,428.5 -598,422.5 -604,416.5 -610,416.5 -610,416.5 -708,416.5 -708,416.5 -714,416.5 -720,422.5 -720,428.5 -720,428.5 -720,527.5 -720,527.5 -720,533.5 -714,539.5 -708,539.5"/>
|
||||||
|
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 68 KiB |
Loading…
Add table
Add a link
Reference in a new issue