Owner can enable public mode for project
This commit is contained in:
parent
a39c910619
commit
729088a7af
6 changed files with 19 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
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
|
||||||
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
|
||||||
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 @@
|
||||||
- @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 @@
|
||||||
= 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 @@
|
||||||
- @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
|
||||||
|
|
Loading…
Add table
Reference in a new issue