Commit e376f3150736e7936082529a3f6c92395f4c9720
1 parent
2a1c5cdf
Exists in
master
and in
4 other branches
Admin can move project to ANY namespace. Updated permissions page
Showing
4 changed files
with
64 additions
and
57 deletions
Show diff stats
app/contexts/project_update_context.rb
| @@ -2,7 +2,9 @@ class ProjectUpdateContext < BaseContext | @@ -2,7 +2,9 @@ class ProjectUpdateContext < BaseContext | ||
| 2 | def execute(role = :default) | 2 | def execute(role = :default) |
| 3 | namespace_id = params[:project].delete(:namespace_id) | 3 | namespace_id = params[:project].delete(:namespace_id) |
| 4 | 4 | ||
| 5 | - if can?(current_user, :change_namespace, project) && namespace_id.present? | 5 | + allowed_transfer = can?(current_user, :change_namespace, project) || role == :admin |
| 6 | + | ||
| 7 | + if allowed_transfer && namespace_id.present? | ||
| 6 | if namespace_id == Namespace.global_id | 8 | if namespace_id == Namespace.global_id |
| 7 | if project.namespace.present? | 9 | if project.namespace.present? |
| 8 | # Transfer to global namespace from anyone | 10 | # Transfer to global namespace from anyone |
app/models/ability.rb
| @@ -99,7 +99,8 @@ class Ability | @@ -99,7 +99,8 @@ class Ability | ||
| 99 | def project_admin_rules | 99 | def project_admin_rules |
| 100 | project_master_rules + [ | 100 | project_master_rules + [ |
| 101 | :change_namespace, | 101 | :change_namespace, |
| 102 | - :rename_project | 102 | + :rename_project, |
| 103 | + :remove_project | ||
| 103 | ] | 104 | ] |
| 104 | end | 105 | end |
| 105 | 106 |
app/views/admin/projects/_form.html.haml
| @@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
| 23 | .clearfix | 23 | .clearfix |
| 24 | = f.label :namespace_id | 24 | = f.label :namespace_id |
| 25 | .input | 25 | .input |
| 26 | - = f.select :namespace_id, namespaces_options(@project.namespace_id), {}, {class: 'chosen'} | 26 | + = f.select :namespace_id, namespaces_options(@project.namespace_id, :all), {}, {class: 'chosen'} |
| 27 | | 27 | |
| 28 | %span.cred Be careful. Changing project namespace can have unintended side effects | 28 | %span.cred Be careful. Changing project namespace can have unintended side effects |
| 29 | 29 |
app/views/help/permissions.html.haml
| @@ -4,61 +4,65 @@ | @@ -4,61 +4,65 @@ | ||
| 4 | ← to index | 4 | ← to index |
| 5 | %hr | 5 | %hr |
| 6 | 6 | ||
| 7 | -.row | ||
| 8 | - .ui-box.span2 | ||
| 9 | - %h5 Guest | ||
| 10 | - %ul.unstyled | ||
| 11 | - %li Create new issue | ||
| 12 | - %li Leave comments | ||
| 13 | - %li Write on project wall | 7 | +%fieldset |
| 8 | + %legend Guest | ||
| 9 | + %ul | ||
| 10 | + %li Create new issue | ||
| 11 | + %li Leave comments | ||
| 12 | + %li Write on project wall | ||
| 14 | 13 | ||
| 15 | - .ui-box.span3 | ||
| 16 | - %h5 Reporter | ||
| 17 | - %ul.unstyled | ||
| 18 | - %li Create new issue | ||
| 19 | - %li Leave comments | ||
| 20 | - %li Write on project wall | ||
| 21 | - %li Pull project code | ||
| 22 | - %li Download project | ||
| 23 | - %li Create new merge request | ||
| 24 | - %li Create a code snippets | 14 | +%fieldset |
| 15 | + %legend Reporter | ||
| 16 | + %ul | ||
| 17 | + %li Create new issue | ||
| 18 | + %li Leave comments | ||
| 19 | + %li Write on project wall | ||
| 20 | + %li Pull project code | ||
| 21 | + %li Download project | ||
| 22 | + %li Create new merge request | ||
| 23 | + %li Create a code snippets | ||
| 25 | 24 | ||
| 26 | 25 | ||
| 27 | - .ui-box.span3 | ||
| 28 | - %h5 Developer | ||
| 29 | - %ul.unstyled | ||
| 30 | - %li Create new issue | ||
| 31 | - %li Leave comments | ||
| 32 | - %li Write on project wall | ||
| 33 | - %li Pull project code | ||
| 34 | - %li Download project | ||
| 35 | - %li Create new merge request | ||
| 36 | - %li Create a code snippets | ||
| 37 | - %li Create new branches | ||
| 38 | - %li Push to non-protected branches | ||
| 39 | - %li Remove non-protected branches | ||
| 40 | - %li Add tags | ||
| 41 | - %li Write a wiki | 26 | +%fieldset |
| 27 | + %legend Developer | ||
| 28 | + %ul | ||
| 29 | + %li Create new issue | ||
| 30 | + %li Leave comments | ||
| 31 | + %li Write on project wall | ||
| 32 | + %li Pull project code | ||
| 33 | + %li Download project | ||
| 34 | + %li Create new merge request | ||
| 35 | + %li Create a code snippets | ||
| 36 | + %li Create new branches | ||
| 37 | + %li Push to non-protected branches | ||
| 38 | + %li Remove non-protected branches | ||
| 39 | + %li Add tags | ||
| 40 | + %li Write a wiki | ||
| 42 | 41 | ||
| 43 | - .ui-box.span3 | ||
| 44 | - %h5 Master | ||
| 45 | - %ul.unstyled | ||
| 46 | - %li Create new issue | ||
| 47 | - %li Leave comments | ||
| 48 | - %li Write on project wall | ||
| 49 | - %li Pull project code | ||
| 50 | - %li Download project | ||
| 51 | - %li Create new merge request | ||
| 52 | - %li Create a code snippets | ||
| 53 | - %li Create new branches | ||
| 54 | - %li Push to non-protected branches | ||
| 55 | - %li Remove non-protected branches | ||
| 56 | - %li Add tags | ||
| 57 | - %li Write a wiki | ||
| 58 | - %li Add new team members | ||
| 59 | - %li Push to protected branches | ||
| 60 | - %li Remove protected branches | ||
| 61 | - %li Push with force option | ||
| 62 | - %li Edit project | ||
| 63 | - %li Add Deploy Keys to project | ||
| 64 | - %li Configure Project Hooks | 42 | +%fieldset |
| 43 | + %legend Master | ||
| 44 | + %ul | ||
| 45 | + %li Create new issue | ||
| 46 | + %li Leave comments | ||
| 47 | + %li Write on project wall | ||
| 48 | + %li Pull project code | ||
| 49 | + %li Download project | ||
| 50 | + %li Create new merge request | ||
| 51 | + %li Create a code snippets | ||
| 52 | + %li Create new branches | ||
| 53 | + %li Push to non-protected branches | ||
| 54 | + %li Remove non-protected branches | ||
| 55 | + %li Add tags | ||
| 56 | + %li Write a wiki | ||
| 57 | + %li Add new team members | ||
| 58 | + %li Push to protected branches | ||
| 59 | + %li Remove protected branches | ||
| 60 | + %li Push with force option | ||
| 61 | + %li Edit project | ||
| 62 | + %li Add Deploy Keys to project | ||
| 63 | + %li Configure Project Hooks | ||
| 64 | + | ||
| 65 | +%fieldset | ||
| 66 | + %legend Owner | ||
| 67 | + %ul | ||
| 68 | + %li Transfer project to another namespace |