Skip to content
Snippets Groups Projects
Commit d6b9b21e authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

Allow access to the wiki with git when repository feature disabled

parent 467b44cb
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -50,6 +50,7 @@ class ProjectPolicy < BasePolicy
 
def reporter_access!
can! :download_code
can! :download_wiki_code
can! :fork_project
can! :create_project_snippet
can! :update_issue
Loading
Loading
@@ -187,6 +188,7 @@ class ProjectPolicy < BasePolicy
 
unless project.feature_available?(:wiki, user) || project.has_external_wiki?
cannot!(*named_abilities(:wiki))
cannot!(:download_wiki_code)
end
 
unless project.feature_available?(:builds, user) && repository_enabled
Loading
Loading
@@ -226,6 +228,7 @@ class ProjectPolicy < BasePolicy
can! :read_commit_status
can! :read_container_image
can! :download_code
can! :download_wiki_code
can! :read_cycle_analytics
 
# NOTE: may be overridden by IssuePolicy
Loading
Loading
Loading
Loading
@@ -46,7 +46,7 @@ module Gitlab
def download_access_check
if user
user_download_access_check
elsif deploy_key.nil? && !Guest.can?(:download_code, project)
elsif deploy_key.nil? && !guest_can_downlod_code?
raise UnauthorizedError, ERROR_MESSAGES[:download]
end
end
Loading
Loading
@@ -59,6 +59,10 @@ module Gitlab
end
end
 
def guest_can_downlod_code?
Guest.can?(:download_code, project)
end
def user_download_access_check
unless user_can_download_code? || build_can_download_code?
raise UnauthorizedError, ERROR_MESSAGES[:download]
Loading
Loading
module Gitlab
class GitAccessWiki < GitAccess
def guest_can_downlod_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 change_access_check(change)
if user_access.can_do_action?(:create_wiki)
build_status_object(true)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment