Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
22d211d0
Commit
22d211d0
authored
Mar 25, 2020
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor data fields common functions to concern
- association, encryption
parent
4807a9b4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
28 deletions
+45
-28
app/models/concerns/services/data_fields.rb
app/models/concerns/services/data_fields.rb
+26
-0
app/models/project_services/data_fields.rb
app/models/project_services/data_fields.rb
+1
-0
app/models/project_services/issue_tracker_data.rb
app/models/project_services/issue_tracker_data.rb
+1
-14
app/models/project_services/jira_tracker_data.rb
app/models/project_services/jira_tracker_data.rb
+1
-14
app/models/project_services/open_project_tracker_data.rb
app/models/project_services/open_project_tracker_data.rb
+16
-0
No files found.
app/models/concerns/services/data_fields.rb
0 → 100644
View file @
22d211d0
# frozen_string_literal: true
module
Services
module
DataFields
extend
ActiveSupport
::
Concern
included
do
belongs_to
:service
delegate
:activated?
,
to: :service
,
allow_nil:
true
validates
:service
,
presence:
true
end
class_methods
do
def
encryption_options
{
key:
Settings
.
attr_encrypted_db_key_base_32
,
encode:
true
,
mode: :per_attribute_iv
,
algorithm:
'aes-256-gcm'
}
end
end
end
end
app/models/project_services/data_fields.rb
View file @
22d211d0
...
@@ -44,6 +44,7 @@ module DataFields
...
@@ -44,6 +44,7 @@ module DataFields
included
do
included
do
has_one
:issue_tracker_data
,
autosave:
true
has_one
:issue_tracker_data
,
autosave:
true
has_one
:jira_tracker_data
,
autosave:
true
has_one
:jira_tracker_data
,
autosave:
true
has_one
:open_project_tracker_data
,
autosave:
true
def
data_fields
def
data_fields
raise
NotImplementedError
raise
NotImplementedError
...
...
app/models/project_services/issue_tracker_data.rb
View file @
22d211d0
# frozen_string_literal: true
# frozen_string_literal: true
class
IssueTrackerData
<
ApplicationRecord
class
IssueTrackerData
<
ApplicationRecord
belongs_to
:service
include
Services
::
DataFields
delegate
:activated?
,
to: :service
,
allow_nil:
true
validates
:service
,
presence:
true
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
:project_url
,
encryption_options
attr_encrypted
:issues_url
,
encryption_options
attr_encrypted
:issues_url
,
encryption_options
...
...
app/models/project_services/jira_tracker_data.rb
View file @
22d211d0
# frozen_string_literal: true
# frozen_string_literal: true
class
JiraTrackerData
<
ApplicationRecord
class
JiraTrackerData
<
ApplicationRecord
belongs_to
:service
include
Services
::
DataFields
delegate
:activated?
,
to: :service
,
allow_nil:
true
validates
:service
,
presence:
true
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
:url
,
encryption_options
attr_encrypted
:url
,
encryption_options
attr_encrypted
:api_url
,
encryption_options
attr_encrypted
:api_url
,
encryption_options
...
...
app/models/project_services/open_project_tracker_data.rb
0 → 100644
View file @
22d211d0
# frozen_string_literal: true
class
OpenProjectTrackerData
<
ApplicationRecord
# When the Open Project is fresh installed, the default closed status id is "13" based on current version: v8.
DEFAULT_CLOSED_STATUS_ID
=
"13"
include
Services
::
DataFields
attr_encrypted
:url
,
encryption_options
attr_encrypted
:api_url
,
encryption_options
attr_encrypted
:token
,
encryption_options
def
closed_status_id
super
||
DEFAULT_CLOSED_STATUS_ID
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment