mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 10:19:45 +02:00
Add more auth methods
This commit is contained in:
parent
d1ec91323b
commit
6352c23cf1
2 changed files with 5 additions and 0 deletions
|
@ -5,6 +5,7 @@ class Epp::DomainsController < EppController
|
||||||
before_action :find_password, only: [:info]
|
before_action :find_password, only: [:info]
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
authorize! :create, Epp::EppDomain
|
||||||
@domain = Epp::EppDomain.new_from_epp(params[:parsed_frame], current_user)
|
@domain = Epp::EppDomain.new_from_epp(params[:parsed_frame], current_user)
|
||||||
|
|
||||||
if @domain.errors.any? || !@domain.save
|
if @domain.errors.any? || !@domain.save
|
||||||
|
@ -20,6 +21,8 @@ class Epp::DomainsController < EppController
|
||||||
end
|
end
|
||||||
|
|
||||||
def check
|
def check
|
||||||
|
authorize! :check, Epp::EppDomain
|
||||||
|
|
||||||
names = params[:parsed_frame].css('name').map(&:text)
|
names = params[:parsed_frame].css('name').map(&:text)
|
||||||
@domains = Epp::EppDomain.check_availability(names)
|
@domains = Epp::EppDomain.check_availability(names)
|
||||||
render_epp_response '/epp/domains/check'
|
render_epp_response '/epp/domains/check'
|
||||||
|
|
|
@ -28,6 +28,8 @@ class Ability
|
||||||
|
|
||||||
# Epp::Domain
|
# Epp::Domain
|
||||||
can(:info, Epp::EppDomain) { |d, pw| d.registrar_id == @user.registrar_id || d.auth_info == pw }
|
can(:info, Epp::EppDomain) { |d, pw| d.registrar_id == @user.registrar_id || d.auth_info == pw }
|
||||||
|
can(:check, Epp::EppDomain)
|
||||||
|
can(:create, Epp::EppDomain)
|
||||||
end
|
end
|
||||||
|
|
||||||
def user
|
def user
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue