From 0bf99f65577d1e0edda8f4e060159d927b308974 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 7 Oct 2014 16:05:24 +0300 Subject: Developers can push to wiki repo. Protected branches does not affect wiki repo any more Signed-off-by: Dmitriy Zaporozhets --- lib/api/internal.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/api') diff --git a/lib/api/internal.rb b/lib/api/internal.rb index 5f484f63418..94aa2f78c2e 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -14,13 +14,20 @@ module API # post "/allowed" do status 200 + project_path = params[:project] # Check for *.wiki repositories. # Strip out the .wiki from the pathname before finding the # project. This applies the correct project permissions to # the wiki repository as well. - project_path = params[:project] - project_path.gsub!(/\.wiki/,'') if project_path =~ /\.wiki/ + access = + if project_path =~ /\.wiki\Z/ + project_path = project_path[0..-6] + Gitlab::GitAccessWiki.new + else + Gitlab::GitAccess.new + end + project = Project.find_with_namespace(project_path) return false unless project @@ -32,7 +39,7 @@ module API return false unless actor - Gitlab::GitAccess.new.allowed?( + access.allowed?( actor, params[:action], project, -- cgit v1.2.1