summaryrefslogtreecommitdiff
path: root/app/controllers/projects_controller.rb
diff options
context:
space:
mode:
authorMarcia Ramos <virtua.creative@gmail.com>2017-04-11 20:01:39 +0000
committerMarcia Ramos <virtua.creative@gmail.com>2017-04-11 20:01:39 +0000
commit40991fc3ce55bbfa87b6ed56515dcceb1e0e8dae (patch)
treefdcaa7a99418411f3ef333106bd2d77879e007d7 /app/controllers/projects_controller.rb
parent85cfde8332d9d5d3280fcb0b9de8d56de2d29ed4 (diff)
parent069c54a7d7a1d1d6ec1dc48c4212139eff6735df (diff)
downloadgitlab-ce-docs-topic-auth.tar.gz
fix conflictdocs-topic-auth
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r--app/controllers/projects_controller.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 47f7e0b1b28..6807c37f972 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -345,7 +345,11 @@ class ProjectsController < Projects::ApplicationController
end
def project_view_files?
- current_user && current_user.project_view == 'files'
+ if current_user
+ current_user.project_view == 'files'
+ else
+ project_view_files_allowed?
+ end
end
# Override extract_ref from ExtractsPath, which returns the branch and file path
@@ -359,4 +363,8 @@ class ProjectsController < Projects::ApplicationController
def get_id
project.repository.root_ref
end
+
+ def project_view_files_allowed?
+ !project.empty_repo? && can?(current_user, :download_code, project)
+ end
end