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
2fe01c8f
Commit
2fe01c8f
authored
Jul 26, 2018
by
Lin Jen-Shin
Committed by
Tiago Botelho
Jul 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move EE specific params to its own module
parent
d5a86c3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
40 deletions
+54
-40
ee/lib/ee/api/projects.rb
ee/lib/ee/api/projects.rb
+20
-0
lib/api/projects.rb
lib/api/projects.rb
+34
-40
No files found.
ee/lib/ee/api/projects.rb
View file @
2fe01c8f
# frozen_string_literal: true
module
EE
module
API
module
Projects
...
...
@@ -10,6 +12,13 @@ module EE
optional
:repository_checksum_failed
,
type:
Grape
::
API
::
Boolean
,
default:
false
,
desc:
'Limit by projects where repository checksum is failed'
end
params
:optional_update_params_ee
do
optional
:mirror_user_id
,
type:
Integer
,
desc:
'User responsible for all the activity surrounding a pull mirror event'
optional
:only_mirror_protected_branches
,
type:
Grape
::
API
::
Boolean
,
desc:
'Only mirror protected branches'
optional
:mirror_overwrites_diverged_branches
,
type:
Grape
::
API
::
Boolean
,
desc:
'Pull mirror overwrites diverged branches'
optional
:import_url
,
type:
String
,
desc:
'URL from which the project is imported'
end
def
apply_filters
(
projects
)
projects
=
super
(
projects
)
projects
=
projects
.
verification_failed_wikis
if
params
[
:wiki_checksum_failed
]
...
...
@@ -19,6 +28,17 @@ module EE
end
end
end
class_methods
do
def
update_params_at_least_one_of
super
.
concat
[
:approvals_before_merge
,
:repository_storage
,
:external_authorization_classification_label
,
:import_url
]
end
end
end
end
end
lib/api/projects.rb
View file @
2fe01c8f
...
...
@@ -13,6 +13,9 @@ module API
# EE::API::Projects would override this helper
end
params
:optional_update_params_ee
do
end
# EE::API::Projects would override this method
def
apply_filters
(
projects
)
projects
=
projects
.
with_issues_available_for_user
(
current_user
)
if
params
[
:with_issues_enabled
]
...
...
@@ -25,6 +28,34 @@ module API
prepend
EE
::
API
::
Projects
def
self
.
update_params_at_least_one_of
[
:jobs_enabled
,
:resolve_outdated_diff_discussions
,
:ci_config_path
,
:container_registry_enabled
,
:default_branch
,
:description
,
:issues_enabled
,
:lfs_enabled
,
:merge_requests_enabled
,
:merge_method
,
:name
,
:only_allow_merge_if_all_discussions_are_resolved
,
:only_allow_merge_if_pipeline_succeeds
,
:path
,
:printing_merge_request_link_enabled
,
:public_builds
,
:request_access_enabled
,
:shared_runners_enabled
,
:snippets_enabled
,
:tag_list
,
:visibility
,
:wiki_enabled
,
:avatar
]
end
helpers
do
params
:statistics_params
do
optional
:statistics
,
type:
Boolean
,
default:
false
,
desc:
'Include project statistics'
...
...
@@ -264,51 +295,14 @@ module API
success
Entities
::
Project
end
params
do
# CE
at_least_one_of_ce
=
[
:jobs_enabled
,
:resolve_outdated_diff_discussions
,
:ci_config_path
,
:container_registry_enabled
,
:default_branch
,
:description
,
:issues_enabled
,
:lfs_enabled
,
:merge_requests_enabled
,
:merge_method
,
:name
,
:only_allow_merge_if_all_discussions_are_resolved
,
:only_allow_merge_if_pipeline_succeeds
,
:path
,
:printing_merge_request_link_enabled
,
:public_builds
,
:request_access_enabled
,
:shared_runners_enabled
,
:snippets_enabled
,
:tag_list
,
:visibility
,
:wiki_enabled
,
:avatar
]
optional
:name
,
type:
String
,
desc:
'The name of the project'
optional
:default_branch
,
type:
String
,
desc:
'The default branch of the project'
optional
:path
,
type:
String
,
desc:
'The path of the repository'
optional
:import_url
,
type:
String
,
desc:
'URL from which the project is imported'
# EE
at_least_one_of_ee
=
[
:approvals_before_merge
,
:repository_storage
,
:external_authorization_classification_label
,
:import_url
]
optional
:mirror_user_id
,
type:
Integer
,
desc:
'User responsible for all the activity surrounding a pull mirror event'
optional
:only_mirror_protected_branches
,
type:
Boolean
,
desc:
'Only mirror protected branches'
optional
:mirror_overwrites_diverged_branches
,
type:
Boolean
,
desc:
'Pull mirror overwrites diverged branches'
use
:optional_project_params
at_least_one_of
(
*
(
at_least_one_of_ce
+
at_least_one_of_ee
))
use
:optional_update_params_ee
at_least_one_of
(
*::
API
::
Projects
.
update_params_at_least_one_of
)
end
put
':id'
do
authorize_admin_project
...
...
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