diff options
Diffstat (limited to 'lib/gitlab/git_access_wiki.rb')
-rw-r--r-- | lib/gitlab/git_access_wiki.rb | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/gitlab/git_access_wiki.rb b/lib/gitlab/git_access_wiki.rb index fdd7e8a8c4a..34378ac8f46 100644 --- a/lib/gitlab/git_access_wiki.rb +++ b/lib/gitlab/git_access_wiki.rb @@ -27,12 +27,21 @@ module Gitlab :create_wiki end - override :check_download_access! - def check_download_access! - super + private + + override :build_can_download? + def build_can_download? + super && user_access.can_do_action?(download_ability) + end - raise ForbiddenError, download_forbidden_message if build_cannot_download? - raise ForbiddenError, download_forbidden_message if deploy_token_cannot_download? + override :deploy_token_can_download? + def deploy_token_can_download? + super && deploy_token.can?(download_ability, container) + end + + override :repository_access_level + def repository_access_level + project&.wiki_access_level end override :check_change_access! @@ -53,17 +62,6 @@ module Gitlab def not_found_message error_message(:not_found) end - - private - - # when accessing via the CI_JOB_TOKEN - def build_cannot_download? - build_can_download_code? && !user_access.can_do_action?(download_ability) - end - - def deploy_token_cannot_download? - deploy_token && !deploy_token.can?(download_ability, container) - end end end |