Remove GitAccessStatus (no longer needed)
This commit is contained in:
parent
b50a22894d
commit
0e3cfc75a3
4 changed files with 9 additions and 26 deletions
|
@ -31,13 +31,13 @@ module Gitlab
|
|||
end
|
||||
|
||||
def exec
|
||||
return GitAccessStatus.new(true) if skip_authorization
|
||||
return true if skip_authorization
|
||||
|
||||
push_checks
|
||||
branch_checks
|
||||
tag_checks
|
||||
|
||||
GitAccessStatus.new(true)
|
||||
true
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
@ -51,7 +51,7 @@ module Gitlab
|
|||
check_push_access!(changes)
|
||||
end
|
||||
|
||||
build_status_object(true)
|
||||
true
|
||||
end
|
||||
|
||||
def guest_can_download_code?
|
||||
|
@ -167,11 +167,9 @@ module Gitlab
|
|||
|
||||
# Iterate over all changes to find if user allowed all of them to be applied
|
||||
changes_list.each do |change|
|
||||
status = 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 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)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -246,9 +244,5 @@ module Gitlab
|
|||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def build_status_object(status)
|
||||
Gitlab::GitAccessStatus.new(status)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
module Gitlab
|
||||
class GitAccessStatus
|
||||
attr_accessor :status, :message
|
||||
alias_method :allowed?, :status
|
||||
|
||||
def initialize(status, message = '')
|
||||
@status = status
|
||||
@message = message
|
||||
end
|
||||
end
|
||||
end
|
|
@ -13,11 +13,11 @@ module Gitlab
|
|||
end
|
||||
|
||||
def check_single_change_access(change)
|
||||
if user_access.can_do_action?(:create_wiki)
|
||||
build_status_object(true)
|
||||
else
|
||||
unless user_access.can_do_action?(:create_wiki)
|
||||
raise UnauthorizedError, ERROR_MESSAGES[:write_to_wiki]
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue