Admin can move project to ANY namespace. Updated permissions page

This commit is contained in:
Dmitriy Zaporozhets 2012-12-04 22:48:24 +02:00
parent 2a1c5cdf99
commit e376f31507
4 changed files with 64 additions and 57 deletions

View file

@ -2,7 +2,9 @@ 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)
if can?(current_user, :change_namespace, project) && namespace_id.present? allowed_transfer = can?(current_user, :change_namespace, project) || role == :admin
if allowed_transfer && namespace_id.present?
if namespace_id == Namespace.global_id if namespace_id == Namespace.global_id
if project.namespace.present? if project.namespace.present?
# Transfer to global namespace from anyone # Transfer to global namespace from anyone

View file

@ -99,7 +99,8 @@ class Ability
def project_admin_rules def project_admin_rules
project_master_rules + [ project_master_rules + [
:change_namespace, :change_namespace,
:rename_project :rename_project,
:remove_project
] ]
end end

View file

@ -23,7 +23,7 @@
.clearfix .clearfix
= f.label :namespace_id = f.label :namespace_id
.input .input
= f.select :namespace_id, namespaces_options(@project.namespace_id), {}, {class: 'chosen'} = f.select :namespace_id, namespaces_options(@project.namespace_id, :all), {}, {class: 'chosen'}
&nbsp; &nbsp;
%span.cred Be careful. Changing project namespace can have unintended side effects %span.cred Be careful. Changing project namespace can have unintended side effects

View file

@ -4,61 +4,65 @@
&larr; to index &larr; to index
%hr %hr
.row %fieldset
.ui-box.span2 %legend Guest
%h5 Guest %ul
%ul.unstyled %li Create new issue
%li Create new issue %li Leave comments
%li Leave comments %li Write on project wall
%li Write on project wall
.ui-box.span3 %fieldset
%h5 Reporter %legend Reporter
%ul.unstyled %ul
%li Create new issue %li Create new issue
%li Leave comments %li Leave comments
%li Write on project wall %li Write on project wall
%li Pull project code %li Pull project code
%li Download project %li Download project
%li Create new merge request %li Create new merge request
%li Create a code snippets %li Create a code snippets
.ui-box.span3 %fieldset
%h5 Developer %legend Developer
%ul.unstyled %ul
%li Create new issue %li Create new issue
%li Leave comments %li Leave comments
%li Write on project wall %li Write on project wall
%li Pull project code %li Pull project code
%li Download project %li Download project
%li Create new merge request %li Create new merge request
%li Create a code snippets %li Create a code snippets
%li Create new branches %li Create new branches
%li Push to non-protected branches %li Push to non-protected branches
%li Remove non-protected branches %li Remove non-protected branches
%li Add tags %li Add tags
%li Write a wiki %li Write a wiki
.ui-box.span3 %fieldset
%h5 Master %legend Master
%ul.unstyled %ul
%li Create new issue %li Create new issue
%li Leave comments %li Leave comments
%li Write on project wall %li Write on project wall
%li Pull project code %li Pull project code
%li Download project %li Download project
%li Create new merge request %li Create new merge request
%li Create a code snippets %li Create a code snippets
%li Create new branches %li Create new branches
%li Push to non-protected branches %li Push to non-protected branches
%li Remove non-protected branches %li Remove non-protected branches
%li Add tags %li Add tags
%li Write a wiki %li Write a wiki
%li Add new team members %li Add new team members
%li Push to protected branches %li Push to protected branches
%li Remove protected branches %li Remove protected branches
%li Push with force option %li Push with force option
%li Edit project %li Edit project
%li Add Deploy Keys to project %li Add Deploy Keys to project
%li Configure Project Hooks %li Configure Project Hooks
%fieldset
%legend Owner
%ul
%li Transfer project to another namespace