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
918210a8
Commit
918210a8
authored
Jun 07, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve conflicts in lib/gitlab/checks/change_access.rb and lib/gitlab/git_access.rb
parent
d3601a49
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
36 deletions
+14
-36
lib/gitlab/checks/change_access.rb
lib/gitlab/checks/change_access.rb
+6
-14
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+8
-22
No files found.
lib/gitlab/checks/change_access.rb
View file @
918210a8
module
Gitlab
module
Gitlab
module
Checks
module
Checks
class
ChangeAccess
class
ChangeAccess
<<<<<<<
HEAD
include
PathLocksHelper
include
PathLocksHelper
# protocol is currently used only in EE
=======
ERROR_MESSAGES
=
{
ERROR_MESSAGES
=
{
push_code:
'You are not allowed to push code to this project.'
,
push_code:
'You are not allowed to push code to this project.'
,
delete_default_branch:
'The default branch of a project cannot be deleted.'
,
delete_default_branch:
'The default branch of a project cannot be deleted.'
,
...
@@ -20,7 +17,7 @@ module Gitlab
...
@@ -20,7 +17,7 @@ module Gitlab
create_protected_tag:
'You are not allowed to create this tag as it is protected.'
create_protected_tag:
'You are not allowed to create this tag as it is protected.'
}.
freeze
}.
freeze
>>>>>>>
ce
/
master
# protocol is currently used only in EE
attr_reader
:user_access
,
:project
,
:skip_authorization
,
:protocol
attr_reader
:user_access
,
:project
,
:skip_authorization
,
:protocol
def
initialize
(
def
initialize
(
...
@@ -39,13 +36,10 @@ module Gitlab
...
@@ -39,13 +36,10 @@ module Gitlab
def
exec
def
exec
return
true
if
skip_authorization
return
true
if
skip_authorization
<<<<<<<
HEAD
error
=
push_checks
||
branch_checks
||
tag_checks
||
push_rule_check
=======
push_checks
push_checks
branch_checks
branch_checks
tag_checks
tag_checks
>>>>>>>
ce
/
master
push_rule_check
true
true
end
end
...
@@ -155,7 +149,7 @@ module Gitlab
...
@@ -155,7 +149,7 @@ module Gitlab
# Prevent tag removal
# Prevent tag removal
if
@tag_name
if
@tag_name
if
tag_deletion_denied_by_push_rule?
(
push_rule
)
if
tag_deletion_denied_by_push_rule?
(
push_rule
)
r
eturn
'You cannot delete a tag'
r
aise
GitAccess
::
UnauthorizedError
,
'You cannot delete a tag'
end
end
else
else
commit_validation
=
push_rule
.
try
(
:commit_validation?
)
commit_validation
=
push_rule
.
try
(
:commit_validation?
)
...
@@ -166,16 +160,14 @@ module Gitlab
...
@@ -166,16 +160,14 @@ module Gitlab
commits
.
each
do
|
commit
|
commits
.
each
do
|
commit
|
if
commit_validation
if
commit_validation
error
=
check_commit
(
commit
,
push_rule
)
error
=
check_commit
(
commit
,
push_rule
)
r
eturn
error
if
error
r
aise
GitAccess
::
UnauthorizedError
,
error
if
error
end
end
if
error
=
check_commit_diff
(
commit
,
push_rule
)
if
error
=
check_commit_diff
(
commit
,
push_rule
)
r
eturn
error
r
aise
GitAccess
::
UnauthorizedError
,
error
end
end
end
end
end
end
nil
end
end
def
tag_deletion_denied_by_push_rule?
(
push_rule
)
def
tag_deletion_denied_by_push_rule?
(
push_rule
)
...
@@ -186,7 +178,7 @@ module Gitlab
...
@@ -186,7 +178,7 @@ module Gitlab
end
end
# If commit does not pass push rule validation the whole push should be rejected.
# If commit does not pass push rule validation the whole push should be rejected.
# This method should return nil if no error found or
status object if there are some errors
.
# This method should return nil if no error found or
a string if error
.
# In case of errors - all other checks will be canceled and push will be rejected.
# In case of errors - all other checks will be canceled and push will be rejected.
def
check_commit
(
commit
,
push_rule
)
def
check_commit
(
commit
,
push_rule
)
unless
push_rule
.
commit_message_allowed?
(
commit
.
safe_message
)
unless
push_rule
.
commit_message_allowed?
(
commit
.
safe_message
)
...
...
lib/gitlab/git_access.rb
View file @
918210a8
...
@@ -17,7 +17,8 @@ module Gitlab
...
@@ -17,7 +17,8 @@ module Gitlab
account_blocked:
'Your account has been blocked.'
,
account_blocked:
'Your account has been blocked.'
,
command_not_allowed:
"The command you're trying to execute is not allowed."
,
command_not_allowed:
"The command you're trying to execute is not allowed."
,
upload_pack_disabled_over_http:
'Pulling over HTTP is not allowed.'
,
upload_pack_disabled_over_http:
'Pulling over HTTP is not allowed.'
,
receive_pack_disabled_over_http:
'Pushing over HTTP is not allowed.'
receive_pack_disabled_over_http:
'Pushing over HTTP is not allowed.'
,
cannot_push_to_secondary_geo:
"You can't push code to a secondary GitLab Geo node."
}.
freeze
}.
freeze
DOWNLOAD_COMMANDS
=
%w{ git-upload-pack git-upload-archive }
.
freeze
DOWNLOAD_COMMANDS
=
%w{ git-upload-pack git-upload-archive }
.
freeze
...
@@ -148,7 +149,7 @@ module Gitlab
...
@@ -148,7 +149,7 @@ module Gitlab
end
end
if
Gitlab
::
Geo
.
secondary?
if
Gitlab
::
Geo
.
secondary?
raise
UnauthorizedError
,
"You can't push code on a secondary GitLab Geo node."
raise
UnauthorizedError
,
ERROR_MESSAGES
[
:cannot_push_to_secondary_geo
]
end
end
if
deploy_key
if
deploy_key
...
@@ -192,13 +193,9 @@ module Gitlab
...
@@ -192,13 +193,9 @@ module Gitlab
# Iterate over all changes to find if user allowed all of them to be applied
# Iterate over all changes to find if user allowed all of them to be applied
changes_list
.
each
do
|
change
|
changes_list
.
each
do
|
change
|
<<<<<<<
HEAD
# If user does not have access to make at least one change, cancel all
status
=
check_single_change_access
(
change
)
# push by allowing the exception to bubble up
check_single_change_access
(
change
)
unless
status
.
allowed?
# If user does not have access to make at least one change - cancel all push
raise
UnauthorizedError
,
status
.
message
end
if
project
.
size_limit_enabled?
if
project
.
size_limit_enabled?
push_size_in_bytes
+=
EE
::
Gitlab
::
Deltas
.
delta_size_check
(
change
,
project
.
repository
)
push_size_in_bytes
+=
EE
::
Gitlab
::
Deltas
.
delta_size_check
(
change
,
project
.
repository
)
...
@@ -207,11 +204,6 @@ module Gitlab
...
@@ -207,11 +204,6 @@ module Gitlab
if
project
.
changes_will_exceed_size_limit?
(
push_size_in_bytes
)
if
project
.
changes_will_exceed_size_limit?
(
push_size_in_bytes
)
raise
UnauthorizedError
,
Gitlab
::
RepositorySizeError
.
new
(
project
).
new_changes_error
raise
UnauthorizedError
,
Gitlab
::
RepositorySizeError
.
new
(
project
).
new_changes_error
=======
# If user does not have access to make at least one change, cancel all
# push by allowing the exception to bubble up
check_single_change_access
(
change
)
>>>>>>>
ce
/
master
end
end
end
end
...
@@ -233,17 +225,16 @@ module Gitlab
...
@@ -233,17 +225,16 @@ module Gitlab
actor
.
is_a?
(
DeployKey
)
actor
.
is_a?
(
DeployKey
)
end
end
<<<<<<<
HEAD
def
geo_node_key
def
geo_node_key
actor
if
geo_node_key?
actor
if
geo_node_key?
end
end
def
geo_node_key?
def
geo_node_key?
actor
.
is_a?
(
GeoNodeKey
)
actor
.
is_a?
(
GeoNodeKey
)
=======
end
def
ci?
def
ci?
actor
==
:ci
actor
==
:ci
>>>>>>>
ce
/
master
end
end
def
can_read_project?
def
can_read_project?
...
@@ -287,13 +278,8 @@ module Gitlab
...
@@ -287,13 +278,8 @@ module Gitlab
case
actor
case
actor
when
User
when
User
actor
actor
<<<<<<<
HEAD
when
DeployKey
nil
when
GeoNodeKey
when
GeoNodeKey
nil
nil
=======
>>>>>>>
ce
/
master
when
Key
when
Key
actor
.
user
unless
actor
.
is_a?
(
DeployKey
)
actor
.
user
unless
actor
.
is_a?
(
DeployKey
)
when
:ci
when
:ci
...
...
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