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
|
||||
def execute(role = :default)
|
||||
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
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ class Ability
|
|||
def project_admin_rules
|
||||
project_master_rules + [
|
||||
:change_namespace,
|
||||
:change_public_mode,
|
||||
:rename_project,
|
||||
:remove_project
|
||||
]
|
||||
|
|
|
@ -26,9 +26,9 @@ class Project < ActiveRecord::Base
|
|||
class TransferError < StandardError; end
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
- @projects.each do |project|
|
||||
%li
|
||||
- if project.public
|
||||
%i.icon-unlock.cred
|
||||
%i.icon-share
|
||||
- else
|
||||
%i.icon-lock.cgreen
|
||||
= link_to project.name_with_namespace, [:admin, project]
|
||||
|
|
|
@ -50,6 +50,19 @@
|
|||
= f.check_box :wiki_enabled
|
||||
%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
|
||||
%fieldset.features
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
- @projects.each do |project|
|
||||
%li.clearfix
|
||||
%h5
|
||||
%i.icon-star.cgreen
|
||||
%i.icon-share
|
||||
= project.name_with_namespace
|
||||
.right
|
||||
%span.monospace.tiny
|
||||
|
|
Loading…
Reference in a new issue