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
8c3a1891
Commit
8c3a1891
authored
Dec 05, 2019
by
mo khan
Committed by
Ash McKenzie
Dec 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert approval_status to classification during update
parent
0d5c00b0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
ee/app/services/software_license_policies/update_service.rb
ee/app/services/software_license_policies/update_service.rb
+12
-1
ee/spec/services/software_license_policies/update_service_spec.rb
...services/software_license_policies/update_service_spec.rb
+1
-7
No files found.
ee/app/services/software_license_policies/update_service.rb
View file @
8c3a1891
...
@@ -12,7 +12,7 @@ module SoftwareLicensePolicies
...
@@ -12,7 +12,7 @@ module SoftwareLicensePolicies
return
success
(
software_license_policy:
software_license_policy
)
unless
params
[
:approval_status
].
present?
return
success
(
software_license_policy:
software_license_policy
)
unless
params
[
:approval_status
].
present?
begin
begin
software_license_policy
.
update
(
classification:
params
[
:approval_status
]
)
software_license_policy
.
update
(
classification:
map_from
(
params
[
:approval_status
])
)
RefreshLicenseComplianceChecksWorker
.
perform_async
(
project
.
id
)
RefreshLicenseComplianceChecksWorker
.
perform_async
(
project
.
id
)
rescue
ArgumentError
=>
ex
rescue
ArgumentError
=>
ex
return
error
(
ex
.
message
,
400
)
return
error
(
ex
.
message
,
400
)
...
@@ -20,5 +20,16 @@ module SoftwareLicensePolicies
...
@@ -20,5 +20,16 @@ module SoftwareLicensePolicies
success
(
software_license_policy:
software_license_policy
)
success
(
software_license_policy:
software_license_policy
)
end
end
private
def
map_from
(
approval_status
)
case
approval_status
when
'blacklisted'
'denied'
else
approval_status
end
end
end
end
end
end
ee/spec/services/software_license_policies/update_service_spec.rb
View file @
8c3a1891
...
@@ -11,13 +11,7 @@ describe SoftwareLicensePolicies::UpdateService do
...
@@ -11,13 +11,7 @@ describe SoftwareLicensePolicies::UpdateService do
end
end
end
end
let
(
:software_license_policy
)
do
let
(
:software_license_policy
)
{
create
(
:software_license_policy
,
:denied
)
}
create
(
:software_license_policy
,
software_license:
create
(
:software_license
,
name:
'ExamplePL/2.1'
),
classification:
'blacklisted'
)
end
before
do
before
do
stub_licensed_features
(
license_management:
true
)
stub_licensed_features
(
license_management:
true
)
...
...
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