Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project_services/issue_tracker_data.rb')
-rw-r--r--app/models/project_services/issue_tracker_data.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/models/project_services/issue_tracker_data.rb b/app/models/project_services/issue_tracker_data.rb
new file mode 100644
index 00000000000..2c1d28ed421
--- /dev/null
+++ b/app/models/project_services/issue_tracker_data.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class IssueTrackerData < ApplicationRecord
+ belongs_to :service
+
+ delegate :activated?, to: :service, allow_nil: true
+
+ validates :service, presence: true
+ validates :project_url, presence: true, public_url: { enforce_sanitization: true }, if: :activated?
+ validates :issues_url, presence: true, public_url: { enforce_sanitization: true }, if: :activated?
+ validates :new_issue_url, public_url: { enforce_sanitization: true }, if: :activated?
+
+ def self.encryption_options
+ {
+ key: Settings.attr_encrypted_db_key_base_32,
+ encode: true,
+ mode: :per_attribute_iv,
+ algorithm: 'aes-256-gcm'
+ }
+ end
+
+ attr_encrypted :project_url, encryption_options
+ attr_encrypted :issues_url, encryption_options
+ attr_encrypted :new_issue_url, encryption_options
+end