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
c212a611
Commit
c212a611
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 verification to EE module
parent
2fe01c8f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
8 deletions
+35
-8
ee/lib/ee/api/projects.rb
ee/lib/ee/api/projects.rb
+26
-0
lib/api/projects.rb
lib/api/projects.rb
+9
-8
No files found.
ee/lib/ee/api/projects.rb
View file @
c212a611
...
...
@@ -26,6 +26,32 @@ module EE
projects
end
def
verify_create_projects_attrs!
(
attrs
)
super
verify_mirror_attrs!
(
attrs
)
if
attrs
[
:mirror
]
attrs
[
:mirror_user_id
]
=
current_user
.
id
end
end
def
verify_update_project_attrs!
(
attrs
)
super
verify_mirror_attrs!
(
attrs
)
unless
valid_mirror_user?
(
attrs
)
render_api_error!
(
"Invalid mirror user"
,
400
)
end
end
def
verify_mirror_attrs!
(
attrs
)
if
attrs
[
:mirror
].
present?
&&
!
mirroring_available?
render_api_error!
(
"Pull mirroring is not available"
,
403
)
end
end
end
end
...
...
lib/api/projects.rb
View file @
c212a611
...
...
@@ -24,6 +24,12 @@ module API
projects
end
def
verify_create_projects_attrs!
(
attrs
)
end
def
verify_update_project_attrs!
(
attrs
)
end
end
prepend
EE
::
API
::
Projects
...
...
@@ -172,9 +178,7 @@ module API
attrs
=
declared_params
(
include_missing:
false
)
attrs
=
translate_params_for_compatibility
(
attrs
)
break
render_api_error!
(
"Pull mirroring is not available"
,
403
)
if
attrs
[
:mirror
].
present?
&&
!
mirroring_available?
attrs
[
:mirror_user_id
]
=
current_user
.
id
if
attrs
[
:mirror
]
verify_create_projects_attrs!
(
attrs
)
project
=
::
Projects
::
CreateService
.
new
(
current_user
,
attrs
).
execute
...
...
@@ -209,9 +213,7 @@ module API
attrs
=
declared_params
(
include_missing:
false
)
attrs
=
translate_params_for_compatibility
(
attrs
)
break
render_api_error!
(
"Pull mirroring is not available"
,
403
)
if
attrs
[
:mirror
].
present?
&&
!
mirroring_available?
attrs
[
:mirror_user_id
]
=
user
.
id
if
attrs
[
:mirror
]
verify_create_projects_attrs!
(
attrs
)
project
=
::
Projects
::
CreateService
.
new
(
user
,
attrs
).
execute
...
...
@@ -312,8 +314,7 @@ module API
attrs
=
translate_params_for_compatibility
(
attrs
)
break
render_api_error!
(
"Pull mirroring is not available"
,
403
)
if
attrs
[
:mirror
].
present?
&&
!
mirroring_available?
break
render_api_error!
(
"Invalid mirror user"
,
400
)
unless
valid_mirror_user?
(
attrs
)
verify_update_project_attrs!
(
attrs
)
result
=
::
Projects
::
UpdateService
.
new
(
user_project
,
current_user
,
attrs
).
execute
...
...
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