Commit 729088a7af7ef7b585066b408542b54f1a1999c5
1 parent
a39c9106
Exists in
master
and in
4 other branches
Owner can enable public mode for project
Showing
6 changed files
with
19 additions
and
4 deletions
Show diff stats
app/contexts/project_update_context.rb
1 | 1 | class ProjectUpdateContext < BaseContext |
2 | 2 | def execute(role = :default) |
3 | 3 | namespace_id = params[:project].delete(:namespace_id) |
4 | + params[:project].delete(:public) unless can?(current_user, :change_public_mode, project) | |
4 | 5 | |
5 | 6 | allowed_transfer = can?(current_user, :change_namespace, project) || role == :admin |
6 | 7 | ... | ... |
app/models/ability.rb
app/models/project.rb
... | ... | @@ -26,9 +26,9 @@ class Project < ActiveRecord::Base |
26 | 26 | class TransferError < StandardError; end |
27 | 27 | |
28 | 28 | attr_accessible :name, :path, :description, :default_branch, :issues_enabled, |
29 | - :wall_enabled, :merge_requests_enabled, :wiki_enabled, as: [:default, :admin] | |
29 | + :wall_enabled, :merge_requests_enabled, :wiki_enabled, :public, as: [:default, :admin] | |
30 | 30 | |
31 | - attr_accessible :namespace_id, :creator_id, :public, as: :admin | |
31 | + attr_accessible :namespace_id, :creator_id, as: :admin | |
32 | 32 | |
33 | 33 | attr_accessor :error_code |
34 | 34 | ... | ... |
app/views/admin/projects/index.html.haml
app/views/projects/_form.html.haml
... | ... | @@ -50,6 +50,19 @@ |
50 | 50 | = f.check_box :wiki_enabled |
51 | 51 | %span.descr Pages for project documentation |
52 | 52 | |
53 | + - if can? current_user, :change_public_mode, @project | |
54 | + %fieldset.features | |
55 | + %legend | |
56 | + %i.icon-share | |
57 | + Public mode: | |
58 | + .control-group | |
59 | + = f.label :public, class: 'control-label' do | |
60 | + %span Public http clone | |
61 | + .controls | |
62 | + = f.check_box :public | |
63 | + %span.descr | |
64 | + If checked this project will be available for clone without any authentification. Also it will appears on #{link_to "Public page", public_root_path} | |
65 | + | |
53 | 66 | |
54 | 67 | - if can? current_user, :change_namespace, @project |
55 | 68 | %fieldset.features | ... | ... |