From 2c0de95363da43caddcf2fe34dab1b22295bec2d Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Mon, 10 Aug 2015 13:53:52 +0300 Subject: [PATCH] Prohibit updating domain when in force delete status #2845 --- Gemfile.lock | 3 --- app/models/domain.rb | 7 +++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e69fa7f99..fcbd6652c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -620,6 +620,3 @@ DEPENDENCIES uuidtools (~> 2.1.4) validates_email_format_of (~> 1.6.3) whenever (~> 0.9.4) - -BUNDLED WITH - 1.10.6 diff --git a/app/models/domain.rb b/app/models/domain.rb index 80cf7bc32..c6a0e7d1f 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -105,6 +105,13 @@ class Domain < ActiveRecord::Base errors.add(:base, :invalid_auth_information_reserved) end + validate :check_permissions + def check_permissions + return unless update_prohibited? || delete_prohibited? + errors.add(:base, I18n.t(:object_status_prohibits_operation)) + false + end + validates :nameservers, object_count: { min: -> { Setting.ns_min_count }, max: -> { Setting.ns_max_count }