summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorStephen Lottermoser <slottermoser@apple.com>2013-05-01 23:52:05 -0700
committerStephen Lottermoser <holdtotherod@gmail.com>2013-05-02 00:06:59 -0700
commit4c44c5ef9a569c65bca8e70078205ef2ce7d6396 (patch)
tree5b10cfdeb170a71744113b1022c63b6ac08bb11e /app
parent4f5aae1d26ac66f8baf0574a2e457597a3e7cc33 (diff)
downloadgitlab-ce-4c44c5ef9a569c65bca8e70078205ef2ce7d6396.tar.gz
Internally public projects
Public projects listed in the public section will be linked to the actual project's page. Public projects now give any user Guest permissions to the project, allowing them to download the code, read and create issues, and view anything else in the project's pages. Ample access tests have been added to the project_access_spec to verify correct permissions and behavior on public projects. - Visitors to the site who are not logged in still cannot view the project's pages. - Logged-in users visiting a public project where they are not a team member can create issues, but not snippets. They can view the projects code, issues, merge requests, etc, just as if they were a Guest member of the project. - Since this is a public project, the user is also granted :download_code permissions, a permission normally reserved for Reporters, since they can clone the repo anyways and browse commits and branches locally.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb2
-rw-r--r--app/models/ability.rb2
-rw-r--r--app/views/projects/_form.html.haml4
-rw-r--r--app/views/public/projects/index.html.haml2
4 files changed, 6 insertions, 4 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 32b1246601d..c2ca23fae53 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -88,7 +88,7 @@ class ApplicationController < ActionController::Base
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) or project.public?
end
def authorize_create_team!
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 5b49104da8a..c5e4524b8ce 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -37,7 +37,7 @@ class Ability
elsif team.reporters.include?(user)
rules << project_report_rules
- elsif team.guests.include?(user)
+ elsif team.guests.include?(user) or project.public?
rules << project_guest_rules
end
diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml
index 4d635e3dc68..0e1fd238005 100644
--- a/app/views/projects/_form.html.haml
+++ b/app/views/projects/_form.html.haml
@@ -48,7 +48,7 @@
Public mode:
.control-group
= f.label :public, class: 'control-label' do
- %span Public clone access
+ %span Public access
.controls
= f.check_box :public
%span.descr
@@ -56,6 +56,8 @@
%em without any
authentication.
It will also be listed on the #{link_to "public access directory", public_root_path}.
+ %em Any
+ user will have #{link_to "Guest", help_permissions_path} permissions on the repository.
%fieldset.features
%legend
diff --git a/app/views/public/projects/index.html.haml b/app/views/public/projects/index.html.haml
index 3d0d793b2d2..e66851ead5b 100644
--- a/app/views/public/projects/index.html.haml
+++ b/app/views/public/projects/index.html.haml
@@ -9,7 +9,7 @@
%li.clearfix
%h5
%i.icon-share
- = project.name_with_namespace
+ = link_to_project project
.pull-right
%pre.dark.tiny git clone #{project.http_url_to_repo}
%p.description