Last active
December 16, 2015 22:29
-
-
Save genewoo/5507620 to your computer and use it in GitHub Desktop.
Enable user to access public project raw files and project without be a member of that project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 458580f297fbda26dc4b0f49cf18b231d1010597 | |
Author: Gene Wu <genewoo_AT_gmail.com> | |
Date: Sun Apr 28 02:03:42 2013 -0700 | |
Enable user to access public project | |
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb | |
index 32b1246..89ab816 100644 | |
--- a/app/controllers/application_controller.rb | |
+++ b/app/controllers/application_controller.rb | |
@@ -65,7 +65,7 @@ class ApplicationController < ActionController::Base | |
@project = Project.find_with_namespace(id) | |
- if @project and can?(current_user, :read_project, @project) | |
+ if @project and can?(current_user, :read_project, @project) or @project.public | |
@project | |
else | |
@project = nil | |
@@ -84,11 +84,11 @@ class ApplicationController < ActionController::Base | |
end | |
def authorize_project!(action) | |
- return access_denied! unless can?(current_user, action, project) | |
+ return access_denied! unless can?(current_user, action, project) || project.public | |
end | |
def authorize_code_access! | |
- return access_denied! unless can?(current_user, :download_code, project) | |
+ return access_denied! unless can?(current_user, :download_code, project) || project.public | |
end | |
def authorize_create_team! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment