Commit 729088a7 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Owner can enable public mode for project

parent a39c9106
class ProjectUpdateContext < BaseContext class ProjectUpdateContext < BaseContext
def execute(role = :default) def execute(role = :default)
namespace_id = params[:project].delete(:namespace_id) namespace_id = params[:project].delete(:namespace_id)
params[:project].delete(:public) unless can?(current_user, :change_public_mode, project)
allowed_transfer = can?(current_user, :change_namespace, project) || role == :admin allowed_transfer = can?(current_user, :change_namespace, project) || role == :admin
......
...@@ -90,6 +90,7 @@ class Ability ...@@ -90,6 +90,7 @@ class Ability
def project_admin_rules def project_admin_rules
project_master_rules + [ project_master_rules + [
:change_namespace, :change_namespace,
:change_public_mode,
:rename_project, :rename_project,
:remove_project :remove_project
] ]
......
...@@ -26,9 +26,9 @@ class Project < ActiveRecord::Base ...@@ -26,9 +26,9 @@ class Project < ActiveRecord::Base
class TransferError < StandardError; end class TransferError < StandardError; end
attr_accessible :name, :path, :description, :default_branch, :issues_enabled, attr_accessible :name, :path, :description, :default_branch, :issues_enabled,
:wall_enabled, :merge_requests_enabled, :wiki_enabled, as: [:default, :admin] :wall_enabled, :merge_requests_enabled, :wiki_enabled, :public, as: [:default, :admin]
attr_accessible :namespace_id, :creator_id, :public, as: :admin attr_accessible :namespace_id, :creator_id, as: :admin
attr_accessor :error_code attr_accessor :error_code
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
- @projects.each do |project| - @projects.each do |project|
%li %li
- if project.public - if project.public
%i.icon-unlock.cred %i.icon-share
- else - else
%i.icon-lock.cgreen %i.icon-lock.cgreen
= link_to project.name_with_namespace, [:admin, project] = link_to project.name_with_namespace, [:admin, project]
......
...@@ -50,6 +50,19 @@ ...@@ -50,6 +50,19 @@
= f.check_box :wiki_enabled = f.check_box :wiki_enabled
%span.descr Pages for project documentation %span.descr Pages for project documentation
- if can? current_user, :change_public_mode, @project
%fieldset.features
%legend
%i.icon-share
Public mode:
.control-group
= f.label :public, class: 'control-label' do
%span Public http clone
.controls
= f.check_box :public
%span.descr
If checked this project will be available for clone without any authentification. Also it will appears on #{link_to "Public page", public_root_path}
- if can? current_user, :change_namespace, @project - if can? current_user, :change_namespace, @project
%fieldset.features %fieldset.features
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
- @projects.each do |project| - @projects.each do |project|
%li.clearfix %li.clearfix
%h5 %h5
%i.icon-star.cgreen %i.icon-share
= project.name_with_namespace = project.name_with_namespace
.right .right
%span.monospace.tiny %span.monospace.tiny
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment