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
f54baa5f
Commit
f54baa5f
authored
Mar 03, 2020
by
Giorgenes Gelatti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor project approvals param filter
parent
2b5d9cb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
ee/lib/api/project_approvals.rb
ee/lib/api/project_approvals.rb
+8
-10
No files found.
ee/lib/api/project_approvals.rb
View file @
f54baa5f
...
@@ -8,18 +8,16 @@ module API
...
@@ -8,18 +8,16 @@ module API
ARRAY_COERCION_LAMBDA
=
->
(
val
)
{
val
.
empty?
?
[]
:
Array
.
wrap
(
val
)
}
ARRAY_COERCION_LAMBDA
=
->
(
val
)
{
val
.
empty?
?
[]
:
Array
.
wrap
(
val
)
}
helpers
do
helpers
do
def
filter_params
(
params
)
def
filter_forbidden_param!
(
permission
,
param
)
unless
can?
(
current_user
,
:modify_merge_request_committer_setting
,
user_project
)
unless
can?
(
current_user
,
permission
,
user_project
)
params
.
delete
(
:merge_requests_disable_committers_approval
)
params
.
delete
(
param
)
end
unless
can?
(
current_user
,
:modify_approvers_rules
,
user_project
)
params
.
delete
(
:disable_overriding_approvers_per_merge_request
)
end
end
end
unless
can?
(
current_user
,
:modify_merge_request_author_setting
,
user_project
)
def
filter_params
(
params
)
params
.
delete
(
:merge_requests_author_approval
)
filter_forbidden_param!
(
:modify_merge_request_committer_setting
,
:merge_requests_disable_committers_approval
)
end
filter_forbidden_param!
(
:modify_approvers_rules
,
:disable_overriding_approvers_per_merge_request
)
filter_forbidden_param!
(
:modify_merge_request_author_setting
,
:merge_requests_author_approval
)
params
params
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