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
Boxiang Sun
gitlab-ce
Commits
47270e1c
Commit
47270e1c
authored
Mar 13, 2017
by
Adam Niedzielski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport changes from gitlab-org/gitlab-ee!1406
parent
32da7602
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
5 deletions
+19
-5
lib/gitlab/checks/change_access.rb
lib/gitlab/checks/change_access.rb
+6
-2
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+3
-1
spec/lib/gitlab/checks/change_access_spec.rb
spec/lib/gitlab/checks/change_access_spec.rb
+10
-2
No files found.
lib/gitlab/checks/change_access.rb
View file @
47270e1c
module
Gitlab
module
Checks
class
ChangeAccess
attr_reader
:user_access
,
:project
,
:skip_authorization
# protocol is currently used only in EE
attr_reader
:user_access
,
:project
,
:skip_authorization
,
:protocol
def
initialize
(
change
,
user_access
:,
project
:,
env:
{},
skip_authorization:
false
)
change
,
user_access
:,
project
:,
env:
{},
skip_authorization:
false
,
protocol:
)
@oldrev
,
@newrev
,
@ref
=
change
.
values_at
(
:oldrev
,
:newrev
,
:ref
)
@branch_name
=
Gitlab
::
Git
.
branch_name
(
@ref
)
@user_access
=
user_access
@project
=
project
@env
=
env
@skip_authorization
=
skip_authorization
@protocol
=
protocol
end
def
exec
...
...
lib/gitlab/git_access.rb
View file @
47270e1c
...
...
@@ -153,7 +153,9 @@ module Gitlab
user_access:
user_access
,
project:
project
,
env:
@env
,
skip_authorization:
deploy_key?
).
exec
skip_authorization:
deploy_key?
,
protocol:
protocol
).
exec
end
def
matching_merge_request?
(
newrev
,
branch_name
)
...
...
spec/lib/gitlab/checks/change_access_spec.rb
View file @
47270e1c
...
...
@@ -12,8 +12,16 @@ describe Gitlab::Checks::ChangeAccess, lib: true do
ref:
'refs/heads/master'
}
end
let
(
:protocol
)
{
'ssh'
}
subject
{
described_class
.
new
(
changes
,
project:
project
,
user_access:
user_access
).
exec
}
subject
do
described_class
.
new
(
changes
,
project:
project
,
user_access:
user_access
,
protocol:
protocol
).
exec
end
before
{
allow
(
user_access
).
to
receive
(
:can_do_action?
).
with
(
:push_code
).
and_return
(
true
)
}
...
...
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