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
0e3cfc75
Commit
0e3cfc75
authored
May 23, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove GitAccessStatus (no longer needed)
parent
b50a2289
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
26 deletions
+9
-26
lib/gitlab/checks/change_access.rb
lib/gitlab/checks/change_access.rb
+2
-2
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+4
-10
lib/gitlab/git_access_status.rb
lib/gitlab/git_access_status.rb
+0
-11
lib/gitlab/git_access_wiki.rb
lib/gitlab/git_access_wiki.rb
+3
-3
No files found.
lib/gitlab/checks/change_access.rb
View file @
0e3cfc75
...
@@ -31,13 +31,13 @@ module Gitlab
...
@@ -31,13 +31,13 @@ module Gitlab
end
end
def
exec
def
exec
return
GitAccessStatus
.
new
(
true
)
if
skip_authorization
return
true
if
skip_authorization
push_checks
push_checks
branch_checks
branch_checks
tag_checks
tag_checks
GitAccessStatus
.
new
(
true
)
true
end
end
protected
protected
...
...
lib/gitlab/git_access.rb
View file @
0e3cfc75
...
@@ -51,7 +51,7 @@ module Gitlab
...
@@ -51,7 +51,7 @@ module Gitlab
check_push_access!
(
changes
)
check_push_access!
(
changes
)
end
end
build_status_object
(
true
)
true
end
end
def
guest_can_download_code?
def
guest_can_download_code?
...
@@ -167,11 +167,9 @@ module Gitlab
...
@@ -167,11 +167,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
|
status
=
check_single_change_access
(
change
)
# If user does not have access to make at least one change, cancel all
unless
status
.
allowed?
# push by allowing the exception to bubble up
# If user does not have access to make at least one change - cancel all push
check_single_change_access
(
change
)
raise
UnauthorizedError
,
status
.
message
end
end
end
end
end
...
@@ -246,9 +244,5 @@ module Gitlab
...
@@ -246,9 +244,5 @@ module Gitlab
nil
nil
end
end
end
end
def
build_status_object
(
status
)
Gitlab
::
GitAccessStatus
.
new
(
status
)
end
end
end
end
end
lib/gitlab/git_access_status.rb
deleted
100644 → 0
View file @
b50a2289
module
Gitlab
class
GitAccessStatus
attr_accessor
:status
,
:message
alias_method
:allowed?
,
:status
def
initialize
(
status
,
message
=
''
)
@status
=
status
@message
=
message
end
end
end
lib/gitlab/git_access_wiki.rb
View file @
0e3cfc75
...
@@ -13,11 +13,11 @@ module Gitlab
...
@@ -13,11 +13,11 @@ module Gitlab
end
end
def
check_single_change_access
(
change
)
def
check_single_change_access
(
change
)
if
user_access
.
can_do_action?
(
:create_wiki
)
unless
user_access
.
can_do_action?
(
:create_wiki
)
build_status_object
(
true
)
else
raise
UnauthorizedError
,
ERROR_MESSAGES
[
:write_to_wiki
]
raise
UnauthorizedError
,
ERROR_MESSAGES
[
:write_to_wiki
]
end
end
true
end
end
end
end
end
end
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