debian-mirror-gitlab/lib/gitlab/git_access_wiki.rb

24 lines
599 B
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
module Gitlab
class GitAccessWiki < GitAccess
2017-09-10 17:25:29 +05:30
ERROR_MESSAGES = {
write_to_wiki: "You are not allowed to write to this project's wiki."
}.freeze
2017-08-17 22:00:37 +05:30
def guest_can_download_code?
Guest.can?(:download_wiki_code, project)
end
def user_can_download_code?
authentication_abilities.include?(:download_code) && user_access.can_do_action?(:download_wiki_code)
end
def check_single_change_access(change)
2017-09-10 17:25:29 +05:30
unless user_access.can_do_action?(:create_wiki)
raise UnauthorizedError, ERROR_MESSAGES[:write_to_wiki]
2015-04-26 12:48:37 +05:30
end
2017-09-10 17:25:29 +05:30
true
2015-04-26 12:48:37 +05:30
end
end
end