Commit 6e78a1d7c8d8fe433a120f403d40379919d958db

Authored by Dmitriy Zaporozhets
2 parents 6e152848 53e54ddf

Merge branch 'improve/project_transfer'

app/contexts/projects/transfer_context.rb 0 → 100644
... ... @@ -0,0 +1,27 @@
  1 +module Projects
  2 + class TransferContext < BaseContext
  3 + def execute(role = :default)
  4 + namespace_id = params[:project].delete(:namespace_id)
  5 + allowed_transfer = can?(current_user, :change_namespace, project) || role == :admin
  6 +
  7 + if allowed_transfer && namespace_id.present?
  8 + if namespace_id == Namespace.global_id
  9 + if project.namespace.present?
  10 + # Transfer to global namespace from anyone
  11 + project.transfer(nil)
  12 + end
  13 + elsif namespace_id.to_i != project.namespace_id
  14 + # Transfer to someone namespace
  15 + namespace = Namespace.find(namespace_id)
  16 + project.transfer(namespace)
  17 + end
  18 + end
  19 +
  20 + rescue ProjectTransferService::TransferError => ex
  21 + project.reload
  22 + project.errors.add(:namespace_id, ex.message)
  23 + false
  24 + end
  25 + end
  26 +end
  27 +
... ...
app/contexts/projects/update_context.rb
1 1 module Projects
2 2 class UpdateContext < BaseContext
3 3 def execute(role = :default)
4   - namespace_id = params[:project].delete(:namespace_id)
  4 + params[:project].delete(:namespace_id)
5 5 params[:project].delete(:public) unless can?(current_user, :change_public_mode, project)
6   -
7   - allowed_transfer = can?(current_user, :change_namespace, project) || role == :admin
8   -
9   - if allowed_transfer && namespace_id.present?
10   - if namespace_id == Namespace.global_id
11   - if project.namespace.present?
12   - # Transfer to global namespace from anyone
13   - project.transfer(nil)
14   - end
15   - elsif namespace_id.to_i != project.namespace_id
16   - # Transfer to someone namespace
17   - namespace = Namespace.find(namespace_id)
18   - project.transfer(namespace)
19   - end
20   - end
21   -
22 6 project.update_attributes(params[:project], as: role)
23 7 end
24 8 end
... ...
app/controllers/admin/projects_controller.rb
... ... @@ -19,34 +19,6 @@ class Admin::ProjectsController &lt; Admin::ApplicationController
19 19 @users = @users.all
20 20 end
21 21  
22   - def edit
23   - end
24   -
25   - def team_update
26   - @project.team.add_users_ids(params[:user_ids], params[:project_access])
27   -
28   - redirect_to [:admin, @project], notice: 'Project was successfully updated.'
29   - end
30   -
31   - def update
32   - project.creator = current_user unless project.creator
33   -
34   - status = ::Projects::UpdateContext.new(project, current_user, params).execute(:admin)
35   -
36   - if status
37   - redirect_to [:admin, @project], notice: 'Project was successfully updated.'
38   - else
39   - render action: "edit"
40   - end
41   - end
42   -
43   - def destroy
44   - @project.team.truncate
45   - @project.destroy
46   -
47   - redirect_to admin_projects_path, notice: 'Project was successfully deleted.'
48   - end
49   -
50 22 protected
51 23  
52 24 def project
... ...
app/controllers/projects_controller.rb
... ... @@ -4,7 +4,7 @@ class ProjectsController &lt; ProjectResourceController
4 4  
5 5 # Authorize
6 6 before_filter :authorize_read_project!, except: [:index, :new, :create]
7   - before_filter :authorize_admin_project!, only: [:edit, :update, :destroy]
  7 + before_filter :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer]
8 8 before_filter :require_non_empty_project, only: [:blob, :tree, :graph]
9 9  
10 10 layout 'application', only: [:new, :create]
... ... @@ -45,10 +45,10 @@ class ProjectsController &lt; ProjectResourceController
45 45 format.js
46 46 end
47 47 end
  48 + end
48 49  
49   - rescue Project::TransferError => ex
50   - @error = ex
51   - render :update_failed
  50 + def transfer
  51 + ::Projects::TransferContext.new(project, current_user, params).execute
52 52 end
53 53  
54 54 def show
... ...
app/models/ability.rb
... ... @@ -41,7 +41,7 @@ class Ability
41 41 rules << project_guest_rules
42 42 end
43 43  
44   - if project.owner == user
  44 + if project.owner == user || user.admin?
45 45 rules << project_admin_rules
46 46 end
47 47  
... ...
app/models/project.rb
... ... @@ -26,8 +26,6 @@ class Project &lt; ActiveRecord::Base
26 26 include Gitlab::ShellAdapter
27 27 extend Enumerize
28 28  
29   - class TransferError < StandardError; end
30   -
31 29 attr_accessible :name, :path, :description, :default_branch, :issues_tracker,
32 30 :issues_enabled, :wall_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id,
33 31 :wiki_enabled, :public, :import_url, as: [:default, :admin]
... ...
app/services/project_transfer_service.rb
... ... @@ -5,6 +5,8 @@
5 5 class ProjectTransferService
6 6 include Gitlab::ShellAdapter
7 7  
  8 + class TransferError < StandardError; end
  9 +
8 10 attr_accessor :project
9 11  
10 12 def transfer(project, new_namespace)
... ... @@ -19,14 +21,18 @@ class ProjectTransferService
19 21 project.namespace = new_namespace
20 22 project.save!
21 23  
  24 + # Move main repository
22 25 unless gitlab_shell.mv_repository(old_path, new_path)
23 26 raise TransferError.new('Cannot move project')
24 27 end
25 28  
  29 + # Move wiki repo also if present
  30 + if project.wikis.any?
  31 + gitlab_shell.mv_repository("#{old_path}.wiki", "#{new_path}.wiki")
  32 + end
  33 +
26 34 true
27 35 end
28   - rescue => ex
29   - raise Project::TransferError.new(ex.message)
30 36 end
31 37 end
32 38  
... ...
app/views/admin/projects/_form.html.haml
... ... @@ -1,86 +0,0 @@
1   -= form_for [:admin, project] do |f|
2   - -if project.errors.any?
3   - .alert.alert-error
4   - %ul
5   - - project.errors.full_messages.each do |msg|
6   - %li= msg
7   -
8   - .clearfix.project_name_holder
9   - = f.label :name do
10   - Project name is
11   - .input
12   - = f.text_field :name, placeholder: "Example Project", class: "xxlarge"
13   -
14   - - if project.repo_exists?
15   - %fieldset.adv_settings
16   - %legend Advanced settings:
17   - .clearfix
18   - = f.label :path do
19   - Path
20   - .input
21   - = text_field_tag :ppath, @project.repository.path_to_repo, class: "xlarge", disabled: true
22   -
23   - .clearfix
24   - = f.label :default_branch, "Default Branch"
25   - .input= f.select(:default_branch, @project.repository.heads.map(&:name), {}, style: "width:210px;")
26   -
27   - %fieldset.adv_settings
28   - %legend Features:
29   -
30   - .clearfix
31   - = f.label :issues_enabled, "Issues"
32   - .input= f.check_box :issues_enabled
33   -
34   - - if Project.issues_tracker.values.count > 1
35   - .clearfix
36   - = f.label :issues_tracker, "Issues tracker", class: 'control-label'
37   - .input= f.select(:issues_tracker, Project.issues_tracker.values, {}, { disabled: !@project.issues_enabled })
38   -
39   - .clearfix
40   - = f.label :issues_tracker_id, "Project name or id in issues tracker", class: 'control-label'
41   - .input= f.text_field :issues_tracker_id, class: "xxlarge", disabled: !@project.can_have_issues_tracker_id?
42   -
43   - .clearfix
44   - = f.label :merge_requests_enabled, "Merge Requests"
45   - .input= f.check_box :merge_requests_enabled
46   -
47   - .clearfix
48   - = f.label :wall_enabled, "Wall"
49   - .input= f.check_box :wall_enabled
50   -
51   - .clearfix
52   - = f.label :wiki_enabled, "Wiki"
53   - .input= f.check_box :wiki_enabled
54   -
55   - %fieldset.features
56   - %legend Public mode:
57   - .clearfix
58   - = f.label :public do
59   - %span Allow public http clone
60   - .input= f.check_box :public
61   -
62   - %fieldset.features
63   - %legend Transfer:
64   - .control-group
65   - = f.label :namespace_id do
66   - %span Namespace
67   - .controls
68   - = f.select :namespace_id, namespaces_options(@project.namespace_id, :all), {}, {class: 'chosen'}
69   - %br
70   - %ul.prepend-top-10.cred
71   - %li Be careful. Changing project namespace can have unintended side effects
72   - %li You can transfer project only to namespaces you can manage
73   - %li You will need to update your local repositories to point to the new location.
74   -
75   -
76   - .actions
77   - = f.submit 'Save Project', class: "btn btn-save"
78   - = link_to 'Cancel', admin_projects_path, class: "btn btn-cancel"
79   -
80   -
81   -
82   -:javascript
83   - $(function(){
84   - new Projects();
85   - })
86   -
app/views/admin/projects/edit.html.haml
... ... @@ -1,3 +0,0 @@
1   -%h3.page_title #{@project.name} &rarr; Edit project
2   -%hr
3   -= render 'form', project: @project
app/views/admin/projects/index.html.haml
... ... @@ -52,8 +52,8 @@
52 52 %i.icon-lock.cgreen
53 53 = link_to project.name_with_namespace, [:admin, project]
54 54 .pull-right
55   - = link_to 'Edit', edit_admin_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
56   - = link_to 'Destroy', [:admin, project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove"
  55 + = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
  56 + = link_to 'Destroy', [project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove"
57 57 - if @projects.blank?
58 58 %p.nothing_here_message 0 projects matches
59 59 - else
... ...
app/views/admin/projects/show.html.haml
1 1 %h3.page_title
2 2 Project: #{@project.name_with_namespace}
3   - = link_to edit_admin_project_path(@project), class: "btn pull-right" do
  3 + = link_to edit_project_path(@project), class: "btn pull-right" do
4 4 %i.icon-edit
5 5 Edit
  6 +%hr
  7 +.row
  8 + .span6
  9 + .ui-box
  10 + %h5.title
  11 + Project info:
  12 + %ul.well-list
  13 + %li
  14 + %span.light Name:
  15 + %strong= @project.name
  16 + %li
  17 + %span.light Namespace:
  18 + %strong
  19 + - if @project.namespace
  20 + = link_to @project.namespace.human_name, [:admin, @project.group || @project.owner]
  21 + - else
  22 + Global
  23 + %li
  24 + %span.light Owned by:
  25 + %strong
  26 + - if @project.owner
  27 + = link_to @project.owner_name, admin_user_path(@project.owner)
  28 + - else
  29 + (deleted)
6 30  
  31 + %li
  32 + %span.light Created by:
  33 + %strong
  34 + = @project.creator.try(:name) || '(deleted)'
7 35  
8   -%br
9   -%table.zebra-striped
10   - %thead
11   - %tr
12   - %th Project
13   - %th
14   - %tr
15   - %td
16   - %b
17   - Name:
18   - %td
19   - = @project.name
20   - %tr
21   - %td
22   - %b
23   - Namespace:
24   - %td
25   - - if @project.namespace
26   - = @project.namespace.human_name
27   - - else
28   - Global
29   - %tr
30   - %td
31   - %b
32   - Owned by:
33   - %td
34   - - if @project.owner
35   - = link_to @project.owner_name, admin_user_path(@project.owner)
36   - - else
37   - (deleted)
38   - %tr
39   - %td
40   - %b
41   - Created by:
42   - %td
43   - = @project.creator.try(:name) || '(deleted)'
44   - %tr
45   - %td
46   - %b
47   - Created at:
48   - %td
49   - = @project.created_at.stamp("March 1, 1999")
50   - %tr
51   - %td
52   - %b
53   - Smart HTTP:
54   - %td
55   - = link_to @project.http_url_to_repo
56   - %tr
57   - %td
58   - %b
59   - SSH:
60   - %td
61   - = link_to @project.ssh_url_to_repo
62   - - if @project.public
63   - %tr.bgred
64   - %td
65   - %b
66   - Public Read-Only Code access:
67   - %td
68   - = check_box_tag 'public', nil, @project.public
  36 + %li
  37 + %span.light Created at:
  38 + %strong
  39 + = @project.created_at.stamp("March 1, 1999")
69 40  
70   -- if @repository
71   - %table.zebra-striped
72   - %thead
73   - %tr
74   - %th Repository
75   - %th
76   - %tr
77   - %td
78   - %b
79   - FS Path:
80   - %td
81   - %code= @repository.path_to_repo
82   - %tr
83   - %td
84   - %b
85   - Last commit at:
86   - %td
87   - = last_commit(@project)
  41 + %li
  42 + %span.light http:
  43 + %strong
  44 + = link_to @project.http_url_to_repo
  45 + %li
  46 + %span.light ssh:
  47 + %strong
  48 + = link_to @project.ssh_url_to_repo
  49 + %li
  50 + %span.light fs:
  51 + %strong
  52 + = @repository.path_to_repo
88 53  
89   -%br
90   -%h5
91   - Team
92   - %small
93   - (#{@project.users.count})
94   -%br
95   -%table.zebra-striped.team_members
96   - %thead
97   - %tr
98   - %th Name
99   - %th Project Access
100   - %th Repository Access
101   - %th
  54 + %li
  55 + %span.light last commit:
  56 + %strong
  57 + - if @repository
  58 + = last_commit(@project)
  59 + - else
  60 + never
102 61  
103   - - @project.users.each do |tm|
104   - %tr
105   - %td
106   - = link_to tm.name, admin_user_path(tm)
107   - %td= @project.project_access_human(tm)
108   - %td= link_to 'Edit Access', edit_admin_project_member_path(@project, tm), class: "btn btn-small"
109   - %td= link_to 'Remove from team', admin_project_member_path(@project, tm), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove small"
110   -
111   -%br
112   -%h5 Add new team member
113   -%br
114   -= form_tag team_update_admin_project_path(@project), class: "bulk_import", method: :put do
115   - %table.zebra-striped
116   - %thead
117   - %tr
118   - %th Users
119   - %th Project Access:
120   -
121   - %tr
122   - %td= select_tag :user_ids, options_from_collection_for_select(@users , :id, :name), multiple: true, data: {placeholder: 'Select users'}, class: 'chosen span5'
123   - %td= select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3"}
124   -
125   - %tr
126   - %td= submit_tag 'Add', class: "btn btn-primary"
127   - %td
128   - Read more about project permissions
129   - %strong= link_to "here", help_permissions_path, class: "vlink"
  62 + %li
  63 + %span.light access:
  64 + %strong
  65 + - if @project.public
  66 + %span.cblue
  67 + %i.icon-share
  68 + Public
  69 + - else
  70 + %span.cgreen
  71 + %i.icon-lock
  72 + Private
  73 + .span6
  74 + .ui-box
  75 + %h5.title
  76 + Team
  77 + %small
  78 + (#{@project.users.count})
  79 + = link_to project_team_index_path(@project), class: "btn btn-tiny" do
  80 + %i.icon-edit
  81 + Edit Team
  82 + %ul.well-list.team_members
  83 + - @project.users.each do |tm|
  84 + %li
  85 + %strong
  86 + = link_to tm.name, admin_user_path(tm)
  87 + %span.pull-right.light= @project.project_access_human(tm)
... ...
app/views/admin/projects/team.html.haml
app/views/projects/_form.html.haml
... ... @@ -107,8 +107,9 @@
107 107 - if can?(current_user, :change_namespace, @project)
108 108 .ui-box.ui-box-danger
109 109 %h5.title Transfer project
  110 + .errors-holder
110 111 .form-holder
111   - = form_for(@project, remote: true, html: { class: 'transfer-project' }) do |f|
  112 + = form_for(@project, url: transfer_project_path(@project), remote: true, html: { class: 'transfer-project' }) do |f|
112 113 .control-group
113 114 = f.label :namespace_id do
114 115 %span Namespace
... ...
app/views/projects/transfer.js.haml 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +- if @project.errors[:namespace_id].present?
  2 + :plain
  3 + $("#tab-transfer .errors-holder").replaceWith(errorMessage('#{escape_javascript(@project.errors[:namespace_id].first)}'));
  4 + $("#tab-transfer .form-actions input").removeAttr('disabled').removeClass('disabled');
  5 +- else
  6 + :plain
  7 + location.href = "#{edit_project_path(@project)}";
... ...
app/views/projects/update_failed.js.haml
... ... @@ -1,2 +0,0 @@
1   -:plain
2   - $(".save-project-loader").replaceWith(errorMessage('#{escape_javascript(@error.message)}'));
config/routes.rb
... ... @@ -85,11 +85,7 @@ Gitlab::Application.routes.draw do
85 85 resource :logs, only: [:show]
86 86 resource :resque, controller: 'resque', only: [:show]
87 87  
88   - resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, except: [:new, :create] do
89   - member do
90   - get :team
91   - put :team_update
92   - end
  88 + resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show] do
93 89 scope module: :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
94 90 resources :members, only: [:edit, :update, :destroy]
95 91 end
... ... @@ -167,6 +163,10 @@ Gitlab::Application.routes.draw do
167 163 # Project Area
168 164 #
169 165 resources :projects, constraints: { id: /(?:[a-zA-Z.0-9_\-]+\/)?[a-zA-Z.0-9_\-]+/ }, except: [:new, :create, :index], path: "/" do
  166 + member do
  167 + put :transfer
  168 + end
  169 +
170 170 resources :blob, only: [:show], constraints: {id: /.+/}
171 171 resources :tree, only: [:show], constraints: {id: /.+/, format: /(html|js)/ }
172 172 resources :edit_tree, only: [:show, :update], constraints: {id: /.+/}, path: 'edit'
... ...
features/steps/admin/admin_projects.rb
... ... @@ -16,9 +16,7 @@ class AdminProjects &lt; Spinach::FeatureSteps
16 16 Then 'I should see project details' do
17 17 project = Project.first
18 18 current_path.should == admin_project_path(project)
19   -
20 19 page.should have_content(project.name_with_namespace)
21 20 page.should have_content(project.creator.name)
22   - page.should have_content('Add new team member')
23 21 end
24 22 end
... ...
lib/tasks/gitlab/check.rake
... ... @@ -637,8 +637,8 @@ namespace :gitlab do
637 637  
638 638 def check_gitlab_shell
639 639 print "GitLab Shell version? ... "
640   - if gitlab_shell_version.strip == '1.1.0'
641   - puts 'OK (1.1.0)'.green
  640 + if gitlab_shell_version.strip == '1.2.0'
  641 + puts 'OK (1.2.0)'.green
642 642 else
643 643 puts 'FAIL. Please update gitlab-shell to v1.1.0'.red
644 644 end
... ...
spec/features/admin/admin_projects_spec.rb
... ... @@ -31,46 +31,4 @@ describe &quot;Admin::Projects&quot; do
31 31 page.should have_content(@project.name)
32 32 end
33 33 end
34   -
35   - describe "GET /admin/projects/:id/edit" do
36   - before do
37   - visit admin_projects_path
38   - click_link "edit_project_#{@project.id}"
39   - end
40   -
41   - it "should have project edit page" do
42   - page.should have_content("Edit project")
43   - page.should have_button("Save Project")
44   - end
45   -
46   - describe "Update project" do
47   - before do
48   - fill_in "project_name", with: "Big Bang"
49   - click_button "Save Project"
50   - @project.reload
51   - end
52   -
53   - it "should show page with new data" do
54   - page.should have_content("Big Bang")
55   - end
56   -
57   - it "should change project entry" do
58   - @project.name.should == "Big Bang"
59   - end
60   - end
61   - end
62   -
63   - describe "Add new team member" do
64   - before do
65   - @new_user = create(:user)
66   - visit admin_project_path(@project)
67   - end
68   -
69   - it "should create new user" do
70   - select @new_user.name, from: "user_ids"
71   - expect { click_button "Add" }.to change { UsersProject.count }.by(1)
72   - page.should have_content @new_user.name
73   - current_path.should == admin_project_path(@project)
74   - end
75   - end
76 34 end
... ...
spec/features/security/project_access_spec.rb
... ... @@ -33,7 +33,7 @@ describe &quot;Application access&quot; do
33 33  
34 34 it { should be_allowed_for master }
35 35 it { should be_allowed_for reporter }
36   - it { should be_denied_for :admin }
  36 + it { should be_allowed_for :admin }
37 37 it { should be_denied_for guest }
38 38 it { should be_denied_for :user }
39 39 it { should be_denied_for :visitor }
... ... @@ -44,7 +44,7 @@ describe &quot;Application access&quot; do
44 44  
45 45 it { should be_allowed_for master }
46 46 it { should be_allowed_for reporter }
47   - it { should be_denied_for :admin }
  47 + it { should be_allowed_for :admin }
48 48 it { should be_denied_for guest }
49 49 it { should be_denied_for :user }
50 50 it { should be_denied_for :visitor }
... ... @@ -55,7 +55,7 @@ describe &quot;Application access&quot; do
55 55  
56 56 it { should be_allowed_for master }
57 57 it { should be_allowed_for reporter }
58   - it { should be_denied_for :admin }
  58 + it { should be_allowed_for :admin }
59 59 it { should be_denied_for guest }
60 60 it { should be_denied_for :user }
61 61 it { should be_denied_for :visitor }
... ... @@ -66,7 +66,7 @@ describe &quot;Application access&quot; do
66 66  
67 67 it { should be_allowed_for master }
68 68 it { should be_allowed_for reporter }
69   - it { should be_denied_for :admin }
  69 + it { should be_allowed_for :admin }
70 70 it { should be_denied_for guest }
71 71 it { should be_denied_for :user }
72 72 it { should be_denied_for :visitor }
... ... @@ -77,7 +77,7 @@ describe &quot;Application access&quot; do
77 77  
78 78 it { should be_allowed_for master }
79 79 it { should be_allowed_for reporter }
80   - it { should be_denied_for :admin }
  80 + it { should be_allowed_for :admin }
81 81 it { should be_denied_for guest }
82 82 it { should be_denied_for :user }
83 83 it { should be_denied_for :visitor }
... ... @@ -88,7 +88,7 @@ describe &quot;Application access&quot; do
88 88  
89 89 it { should be_allowed_for master }
90 90 it { should be_allowed_for reporter }
91   - it { should be_denied_for :admin }
  91 + it { should be_allowed_for :admin }
92 92 it { should be_denied_for guest }
93 93 it { should be_denied_for :user }
94 94 it { should be_denied_for :visitor }
... ... @@ -99,7 +99,7 @@ describe &quot;Application access&quot; do
99 99  
100 100 it { should be_allowed_for master }
101 101 it { should be_allowed_for reporter }
102   - it { should be_denied_for :admin }
  102 + it { should be_allowed_for :admin }
103 103 it { should be_denied_for guest }
104 104 it { should be_denied_for :user }
105 105 it { should be_denied_for :visitor }
... ... @@ -114,7 +114,7 @@ describe &quot;Application access&quot; do
114 114  
115 115 it { @blob_path.should be_allowed_for master }
116 116 it { @blob_path.should be_allowed_for reporter }
117   - it { @blob_path.should be_denied_for :admin }
  117 + it { @blob_path.should be_allowed_for :admin }
118 118 it { @blob_path.should be_denied_for guest }
119 119 it { @blob_path.should be_denied_for :user }
120 120 it { @blob_path.should be_denied_for :visitor }
... ... @@ -125,7 +125,7 @@ describe &quot;Application access&quot; do
125 125  
126 126 it { should be_allowed_for master }
127 127 it { should be_denied_for reporter }
128   - it { should be_denied_for :admin }
  128 + it { should be_allowed_for :admin }
129 129 it { should be_denied_for guest }
130 130 it { should be_denied_for :user }
131 131 it { should be_denied_for :visitor }
... ... @@ -136,7 +136,7 @@ describe &quot;Application access&quot; do
136 136  
137 137 it { should be_allowed_for master }
138 138 it { should be_denied_for reporter }
139   - it { should be_denied_for :admin }
  139 + it { should be_allowed_for :admin }
140 140 it { should be_denied_for guest }
141 141 it { should be_denied_for :user }
142 142 it { should be_denied_for :visitor }
... ... @@ -147,7 +147,7 @@ describe &quot;Application access&quot; do
147 147  
148 148 it { should be_allowed_for master }
149 149 it { should be_allowed_for reporter }
150   - it { should be_denied_for :admin }
  150 + it { should be_allowed_for :admin }
151 151 it { should be_denied_for guest }
152 152 it { should be_denied_for :user }
153 153 it { should be_denied_for :visitor }
... ... @@ -158,7 +158,7 @@ describe &quot;Application access&quot; do
158 158  
159 159 it { should be_allowed_for master }
160 160 it { should be_allowed_for reporter }
161   - it { should be_denied_for :admin }
  161 + it { should be_allowed_for :admin }
162 162 it { should be_denied_for guest }
163 163 it { should be_denied_for :user }
164 164 it { should be_denied_for :visitor }
... ... @@ -169,7 +169,7 @@ describe &quot;Application access&quot; do
169 169  
170 170 it { should be_allowed_for master }
171 171 it { should be_allowed_for reporter }
172   - it { should be_denied_for :admin }
  172 + it { should be_allowed_for :admin }
173 173 it { should be_denied_for guest }
174 174 it { should be_denied_for :user }
175 175 it { should be_denied_for :visitor }
... ... @@ -180,7 +180,7 @@ describe &quot;Application access&quot; do
180 180  
181 181 it { should be_allowed_for master }
182 182 it { should be_allowed_for reporter }
183   - it { should be_denied_for :admin }
  183 + it { should be_allowed_for :admin }
184 184 it { should be_denied_for guest }
185 185 it { should be_denied_for :user }
186 186 it { should be_denied_for :visitor }
... ... @@ -196,7 +196,7 @@ describe &quot;Application access&quot; do
196 196  
197 197 it { should be_allowed_for master }
198 198 it { should be_allowed_for reporter }
199   - it { should be_denied_for :admin }
  199 + it { should be_allowed_for :admin }
200 200 it { should be_denied_for guest }
201 201 it { should be_denied_for :user }
202 202 it { should be_denied_for :visitor }
... ... @@ -212,7 +212,7 @@ describe &quot;Application access&quot; do
212 212  
213 213 it { should be_allowed_for master }
214 214 it { should be_allowed_for reporter }
215   - it { should be_denied_for :admin }
  215 + it { should be_allowed_for :admin }
216 216 it { should be_denied_for guest }
217 217 it { should be_denied_for :user }
218 218 it { should be_denied_for :visitor }
... ... @@ -223,7 +223,7 @@ describe &quot;Application access&quot; do
223 223  
224 224 it { should be_allowed_for master }
225 225 it { should be_allowed_for reporter }
226   - it { should be_denied_for :admin }
  226 + it { should be_allowed_for :admin }
227 227 it { should be_denied_for guest }
228 228 it { should be_denied_for :user }
229 229 it { should be_denied_for :visitor }
... ...
spec/routing/admin_routing_spec.rb
... ... @@ -66,33 +66,13 @@ end
66 66 # PUT /admin/projects/:id(.:format) admin/projects#update {:id=>/[^\/]+/}
67 67 # DELETE /admin/projects/:id(.:format) admin/projects#destroy {:id=>/[^\/]+/}
68 68 describe Admin::ProjectsController, "routing" do
69   - it "to #team" do
70   - get("/admin/projects/gitlab/team").should route_to('admin/projects#team', id: 'gitlab')
71   - end
72   -
73   - it "to #team_update" do
74   - put("/admin/projects/gitlab/team_update").should route_to('admin/projects#team_update', id: 'gitlab')
75   - end
76   -
77 69 it "to #index" do
78 70 get("/admin/projects").should route_to('admin/projects#index')
79 71 end
80 72  
81   - it "to #edit" do
82   - get("/admin/projects/gitlab/edit").should route_to('admin/projects#edit', id: 'gitlab')
83   - end
84   -
85 73 it "to #show" do
86 74 get("/admin/projects/gitlab").should route_to('admin/projects#show', id: 'gitlab')
87 75 end
88   -
89   - it "to #update" do
90   - put("/admin/projects/gitlab").should route_to('admin/projects#update', id: 'gitlab')
91   - end
92   -
93   - it "to #destroy" do
94   - delete("/admin/projects/gitlab").should route_to('admin/projects#destroy', id: 'gitlab')
95   - end
96 76 end
97 77  
98 78 # edit_admin_project_member GET /admin/projects/:project_id/members/:id/edit(.:format) admin/projects/members#edit {:id=>/[^\/]+/, :project_id=>/[^\/]+/}
... ...