mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 18:59:38 +02:00
Merge branch 'master' of github.com:internetee/registry
This commit is contained in:
commit
e7fb6208ce
12 changed files with 77 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
|||
class Admin::ContactsController < ApplicationController
|
||||
class Admin::ContactsController < AdminController
|
||||
# TODO created_by and updated_by ids
|
||||
before_action :set_contact, only: [:show, :destroy, :edit, :update]
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Admin::DomainsController < ApplicationController
|
||||
class Admin::DomainsController < AdminController
|
||||
before_action :set_domain, only: [:show, :edit, :update, :destroy]
|
||||
before_action :verify_deletion, only: [:destroy]
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Admin::RegistrarsController < ApplicationController
|
||||
class Admin::RegistrarsController < AdminController
|
||||
def search
|
||||
render json: Registrar.search_by_query(params[:q])
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Admin::SettingGroupsController < ApplicationController
|
||||
class Admin::SettingGroupsController < AdminController
|
||||
before_action :set_setting_group, only: [:show, :update]
|
||||
|
||||
def index
|
||||
|
|
7
app/controllers/admin_controller.rb
Normal file
7
app/controllers/admin_controller.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class AdminController < ApplicationController
|
||||
before_action :verify_admin
|
||||
|
||||
def verify_admin
|
||||
redirect_to client_root_path unless current_user.try(:admin?)
|
||||
end
|
||||
end
|
|
@ -2,7 +2,8 @@ class Client::DomainsController < ClientController
|
|||
include Shared::CommonDomain
|
||||
|
||||
def index
|
||||
@q = current_user.registrar.domains.search(params[:q])
|
||||
@q = Domain.search(params[:q]) if current_user.admin?
|
||||
@q = current_user.registrar.domains.search(params[:q]) unless current_user.admin?
|
||||
@domains = @q.result.page(params[:page])
|
||||
end
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
class SessionsController < Devise::SessionsController
|
||||
def create
|
||||
if Rails.env.development?
|
||||
if Rails.env.development? || Rails.env.test?
|
||||
@user = User.find_by(username: 'gitlab') if params[:gitlab]
|
||||
@user = User.find_by(username: 'zone') if params[:zone]
|
||||
|
||||
flash[:notice] = I18n.t('shared.welcome')
|
||||
sign_in_and_redirect @user, :event => :authentication
|
||||
return
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue