diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /lib/gitlab/git_access_wiki.rb | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
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 |