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
7f8682d9
Commit
7f8682d9
authored
Jun 08, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix conflicts in git / wiki access
parent
3275a767
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
406 deletions
+6
-406
lib/gitlab/git_access_wiki.rb
lib/gitlab/git_access_wiki.rb
+4
-10
spec/lib/gitlab/git_access_spec.rb
spec/lib/gitlab/git_access_spec.rb
+0
-32
spec/lib/gitlab/git_access_wiki_spec.rb
spec/lib/gitlab/git_access_wiki_spec.rb
+0
-4
spec/requests/git_http_spec.rb
spec/requests/git_http_spec.rb
+2
-360
No files found.
lib/gitlab/git_access_wiki.rb
View file @
7f8682d9
module
Gitlab
module
Gitlab
class
GitAccessWiki
<
GitAccess
class
GitAccessWiki
<
GitAccess
ERROR_MESSAGES
=
{
ERROR_MESSAGES
=
{
<<<<<<<
HEAD
geo:
"You can't push code to a secondary GitLab Geo node."
,
geo:
"You can't push code to a secondary GitLab Geo node."
,
=======
>>>>>>>
master
write_to_wiki:
"You are not allowed to write to this project's wiki."
write_to_wiki:
"You are not allowed to write to this project's wiki."
}.
freeze
}.
freeze
...
@@ -17,17 +14,14 @@ module Gitlab
...
@@ -17,17 +14,14 @@ module Gitlab
end
end
def
check_single_change_access
(
change
)
def
check_single_change_access
(
change
)
<<<<<<<
HEAD
if
Gitlab
::
Geo
.
enabled?
&&
Gitlab
::
Geo
.
secondary?
raise
UnauthorizedError
,
ERROR_MESSAGES
[
:geo
]
end
=======
>>>>>>>
master
unless
user_access
.
can_do_action?
(
:create_wiki
)
unless
user_access
.
can_do_action?
(
:create_wiki
)
raise
UnauthorizedError
,
ERROR_MESSAGES
[
:write_to_wiki
]
raise
UnauthorizedError
,
ERROR_MESSAGES
[
:write_to_wiki
]
end
end
if
Gitlab
::
Geo
.
enabled?
&&
Gitlab
::
Geo
.
secondary?
raise
UnauthorizedError
,
ERROR_MESSAGES
[
:geo
]
end
true
true
end
end
end
end
...
...
spec/lib/gitlab/git_access_spec.rb
View file @
7f8682d9
...
@@ -8,10 +8,7 @@ describe Gitlab::GitAccess, lib: true do
...
@@ -8,10 +8,7 @@ describe Gitlab::GitAccess, lib: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:actor
)
{
user
}
let
(
:actor
)
{
user
}
let
(
:protocol
)
{
'ssh'
}
let
(
:protocol
)
{
'ssh'
}
<<<<<<<
HEAD
=======
>>>>>>>
master
let
(
:authentication_abilities
)
do
let
(
:authentication_abilities
)
do
[
[
:read_project
,
:read_project
,
...
@@ -172,7 +169,6 @@ describe Gitlab::GitAccess, lib: true do
...
@@ -172,7 +169,6 @@ describe Gitlab::GitAccess, lib: true do
before
do
before
do
allow
(
Gitlab
.
config
.
gitlab_shell
).
to
receive
(
:upload_pack
).
and_return
(
false
)
allow
(
Gitlab
.
config
.
gitlab_shell
).
to
receive
(
:upload_pack
).
and_return
(
false
)
end
end
<<<<<<<
HEAD
context
'when calling git-upload-pack'
do
context
'when calling git-upload-pack'
do
it
{
expect
{
pull_access_check
}.
to
raise_unauthorized
(
'Pulling over HTTP is not allowed.'
)
}
it
{
expect
{
pull_access_check
}.
to
raise_unauthorized
(
'Pulling over HTTP is not allowed.'
)
}
...
@@ -199,34 +195,6 @@ describe Gitlab::GitAccess, lib: true do
...
@@ -199,34 +195,6 @@ describe Gitlab::GitAccess, lib: true do
end
end
end
end
=======
context
'when calling git-upload-pack'
do
it
{
expect
{
pull_access_check
}.
to
raise_unauthorized
(
'Pulling over HTTP is not allowed.'
)
}
end
context
'when calling git-receive-pack'
do
it
{
expect
{
push_access_check
}.
not_to
raise_error
}
end
end
context
'when the git-receive-pack command is disabled in config'
do
before
do
allow
(
Gitlab
.
config
.
gitlab_shell
).
to
receive
(
:receive_pack
).
and_return
(
false
)
end
context
'when calling git-receive-pack'
do
it
{
expect
{
push_access_check
}.
to
raise_unauthorized
(
'Pushing over HTTP is not allowed.'
)
}
end
context
'when calling git-upload-pack'
do
it
{
expect
{
pull_access_check
}.
not_to
raise_error
}
end
end
end
end
>>>>>>>
master
describe
'#check_download_access!'
do
describe
'#check_download_access!'
do
describe
'master permissions'
do
describe
'master permissions'
do
before
{
project
.
team
<<
[
user
,
:master
]
}
before
{
project
.
team
<<
[
user
,
:master
]
}
...
...
spec/lib/gitlab/git_access_wiki_spec.rb
View file @
7f8682d9
...
@@ -31,13 +31,9 @@ describe Gitlab::GitAccessWiki, lib: true do
...
@@ -31,13 +31,9 @@ describe Gitlab::GitAccessWiki, lib: true do
allow
(
Gitlab
::
Geo
).
to
receive
(
:license_allows?
)
{
true
}
allow
(
Gitlab
::
Geo
).
to
receive
(
:license_allows?
)
{
true
}
end
end
<<<<<<<
HEAD
it
{
expect
{
subject
}.
to
raise_error
(
Gitlab
::
GitAccess
::
UnauthorizedError
,
"You can't push code to a secondary GitLab Geo node."
)
}
=======
it
'does not give access to upload wiki code'
do
it
'does not give access to upload wiki code'
do
expect
{
subject
}.
to
raise_error
(
Gitlab
::
GitAccess
::
UnauthorizedError
,
"You can't push code to a secondary GitLab Geo node."
)
expect
{
subject
}.
to
raise_error
(
Gitlab
::
GitAccess
::
UnauthorizedError
,
"You can't push code to a secondary GitLab Geo node."
)
end
end
>>>>>>>
master
end
end
end
end
end
end
...
...
spec/requests/git_http_spec.rb
View file @
7f8682d9
This diff is collapsed.
Click to expand it.
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