mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +02:00
Delete and transfer to cancan
This commit is contained in:
parent
8a8da67d38
commit
010cc81e10
4 changed files with 11 additions and 71 deletions
|
@ -27,11 +27,12 @@ class Ability
|
|||
can(:view_password, Epp::Contact) { |c| c.registrar_id == @user.registrar_id }
|
||||
|
||||
# Epp::Domain
|
||||
can(:info, Epp::EppDomain) { |d, pw| d.registrar_id == @user.registrar_id || d.auth_info == pw }
|
||||
can(:check, Epp::EppDomain)
|
||||
can(:create, Epp::EppDomain)
|
||||
can(:renew, Epp::EppDomain)
|
||||
can(:update, 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)
|
||||
can(:renew, Epp::EppDomain)
|
||||
can(:update, Epp::EppDomain) { |d, pw| d.registrar_id == @user.registrar_id || d.auth_info == pw }
|
||||
can(:transfer, Epp::EppDomain) { |d, pw| d.auth_info == pw }
|
||||
end
|
||||
|
||||
def user
|
||||
|
|
|
@ -11,9 +11,6 @@ class Nameserver < ActiveRecord::Base
|
|||
validates :ipv6, format: { with: /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/, allow_blank: true }
|
||||
# rubocop: enable Metrics/LineLength
|
||||
|
||||
# TODO: remove old
|
||||
# after_destroy :domain_version
|
||||
|
||||
before_validation :normalize_attributes
|
||||
|
||||
delegate :name, to: :domain, prefix: true
|
||||
|
@ -34,26 +31,12 @@ class Nameserver < ActiveRecord::Base
|
|||
}
|
||||
end
|
||||
|
||||
# TODO: remove old
|
||||
# def snapshot
|
||||
# {
|
||||
# hostname: hostname,
|
||||
# ipv4: ipv4,
|
||||
# ipv6: ipv6
|
||||
# }
|
||||
# end
|
||||
|
||||
def normalize_attributes
|
||||
self.hostname = hostname.try(:strip).try(:downcase)
|
||||
self.ipv4 = ipv4.try(:strip)
|
||||
self.ipv6 = ipv6.try(:strip).try(:upcase)
|
||||
end
|
||||
|
||||
# TODO: remove old
|
||||
# def domain_version
|
||||
# domain.create_version if domain
|
||||
# end
|
||||
|
||||
def to_s
|
||||
hostname
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue