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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
be221a30
Commit
be221a30
authored
Jun 30, 2016
by
Patricio Cano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert back to not defining a default Git access protocol.
parent
cb24650a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
6 additions
and
6 deletions
+6
-6
app/helpers/branches_helper.rb
app/helpers/branches_helper.rb
+1
-1
app/models/merge_request.rb
app/models/merge_request.rb
+1
-1
app/services/commits/change_service.rb
app/services/commits/change_service.rb
+1
-1
app/services/files/base_service.rb
app/services/files/base_service.rb
+1
-1
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+1
-1
spec/lib/gitlab/git_access_spec.rb
spec/lib/gitlab/git_access_spec.rb
+1
-1
No files found.
app/helpers/branches_helper.rb
View file @
be221a30
...
...
@@ -12,7 +12,7 @@ module BranchesHelper
def
can_push_branch?
(
project
,
branch_name
)
return
false
unless
project
.
repository
.
branch_exists?
(
branch_name
)
::
Gitlab
::
GitAccess
.
new
(
current_user
,
project
).
can_push_to_branch?
(
branch_name
)
::
Gitlab
::
GitAccess
.
new
(
current_user
,
project
,
'web'
).
can_push_to_branch?
(
branch_name
)
end
def
project_branches
...
...
app/models/merge_request.rb
View file @
be221a30
...
...
@@ -481,7 +481,7 @@ class MergeRequest < ActiveRecord::Base
end
def
can_be_merged_by?
(
user
)
::
Gitlab
::
GitAccess
.
new
(
user
,
project
).
can_push_to_branch?
(
target_branch
)
::
Gitlab
::
GitAccess
.
new
(
user
,
project
,
'web'
).
can_push_to_branch?
(
target_branch
)
end
def
mergeable_ci_state?
...
...
app/services/commits/change_service.rb
View file @
be221a30
...
...
@@ -23,7 +23,7 @@ module Commits
private
def
check_push_permissions
allowed
=
::
Gitlab
::
GitAccess
.
new
(
current_user
,
project
).
can_push_to_branch?
(
@target_branch
)
allowed
=
::
Gitlab
::
GitAccess
.
new
(
current_user
,
project
,
'web'
).
can_push_to_branch?
(
@target_branch
)
unless
allowed
raise
ValidationError
.
new
(
'You are not allowed to push into this branch'
)
...
...
app/services/files/base_service.rb
View file @
be221a30
...
...
@@ -43,7 +43,7 @@ module Files
end
def
validate
allowed
=
::
Gitlab
::
GitAccess
.
new
(
current_user
,
project
).
can_push_to_branch?
(
@target_branch
)
allowed
=
::
Gitlab
::
GitAccess
.
new
(
current_user
,
project
,
'web'
).
can_push_to_branch?
(
@target_branch
)
unless
allowed
raise_error
(
"You are not allowed to push into this branch"
)
...
...
lib/gitlab/git_access.rb
View file @
be221a30
...
...
@@ -5,7 +5,7 @@ module Gitlab
attr_reader
:actor
,
:project
,
:protocol
def
initialize
(
actor
,
project
,
protocol
=
'web'
)
def
initialize
(
actor
,
project
,
protocol
)
@actor
=
actor
@project
=
project
@protocol
=
protocol
...
...
spec/lib/gitlab/git_access_spec.rb
View file @
be221a30
require
'spec_helper'
describe
Gitlab
::
GitAccess
,
lib:
true
do
let
(
:access
)
{
Gitlab
::
GitAccess
.
new
(
actor
,
project
)
}
let
(
:access
)
{
Gitlab
::
GitAccess
.
new
(
actor
,
project
,
'web'
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:actor
)
{
user
}
...
...
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