remove OpenDataExport permissions/routes
the gem will handle the process of including them Change-Id: I2237b4cad388756f91f67138a716ae5a8472d9df Reviewed-on: https://gerrit.instructure.com/32586 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Nick Cloward <ncloward@instructure.com> QA-Review: August Thornton <august@instructure.com> Product-Review: Anthus Williams <awilliams@instructure.com>
This commit is contained in:
parent
1f43d6038a
commit
4050f5e0b3
|
@ -646,12 +646,6 @@ class RoleOverride < ActiveRecord::Base
|
|||
:true_for => %w(AccountAdmin),
|
||||
:available_to => %w(AccountAdmin AccountMembership)
|
||||
},
|
||||
:manage_data_exports => {
|
||||
:label => lambda { t('permissions.generate_data_exports', "Generate Data Exports") }, #TODO add this setting to Permissions pane in account/settings.html.erb
|
||||
:account_only => true,
|
||||
:true_for => %w(AccountAdmin),
|
||||
:available_to => %w(AccountAdmin AccountMembership)
|
||||
},
|
||||
:manage_storage_quotas => {
|
||||
:label => lambda { t('permissions.manage_storage_quotas', "Manage storage quotas") },
|
||||
:account_only => true,
|
||||
|
|
|
@ -1484,14 +1484,6 @@ routes.draw do
|
|||
get "#{prefix}/:id", :action => :show
|
||||
end
|
||||
|
||||
scope(:controller => :data_exports_api, :module => :data_exports_api) do
|
||||
prefix = "accounts/:account_id/data_exports"
|
||||
get prefix, :action => :index, :path_name => "data_exports"
|
||||
post prefix, :action => :create
|
||||
get '#{prefix}/:id', :action => :show, :path_name => "data_export"
|
||||
delete '#{prefix}/:id', :action => :cancel
|
||||
end
|
||||
|
||||
scope(:controller => :grading_standards_api) do
|
||||
post 'accounts/:account_id/grading_standards', :action => :create
|
||||
post 'courses/:course_id/grading_standards', :action => :create
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
||||
|
||||
describe DataExportsApi::DataExportsApiController do
|
||||
def json_body
|
||||
JSON.parse(response.body.split(';').last)
|
||||
end
|
||||
|
||||
describe "POST" do
|
||||
before(:each) do
|
||||
account_admin_user(:account => account_model)
|
||||
end
|
||||
|
||||
it "should authenticate against account" do
|
||||
post :create, :format => "json", :account_id => Account.default.id
|
||||
assert_status(401)
|
||||
end
|
||||
|
||||
it "should check against manage_data_export permissions" do
|
||||
user_session(account_admin_user_with_role_changes(:account_id => @account.id, :role_changes => {:manage_data_exports => false}))
|
||||
post :create, :format => "json", :account_id => @account.id
|
||||
assert_status(401)
|
||||
end
|
||||
|
||||
it "should create a new data export" do
|
||||
user_session(@user)
|
||||
expect { post :create, :format => "json", :account_id => @account.id }.to change(DataExportsApi::DataExport.for(@account), :count).by 1
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET" do
|
||||
before(:each) do
|
||||
account_admin_user(:account => account_model)
|
||||
@dd = DataExportsApi::DataExport.for(@account).build(user: @user)
|
||||
@dd.save!
|
||||
end
|
||||
|
||||
it "should retrieve existing data export" do
|
||||
user_session(@user)
|
||||
get "show", :format => "json", :account_id => @account.id, :id => @dd.id
|
||||
response.should be_success
|
||||
r = json_body["data_exports"].first
|
||||
r["id"].should == @dd.id
|
||||
r["user"]["id"].should == @user.id
|
||||
r["account"]["id"].should == @account.id
|
||||
end
|
||||
|
||||
it "should retrieve all data exports for an account" do
|
||||
user_session(@user)
|
||||
@dd2 = DataExportsApi::DataExport.for(@account).build(user: @user)
|
||||
@dd2.save!
|
||||
get "index", :format => "json", :account_id => @account.id
|
||||
json_body["data_exports"].map {|j| j["id"] }.sort.should == [@dd.id, @dd2.id]
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE" do
|
||||
before(:each) do
|
||||
account_admin_user(:account => account_model)
|
||||
@dd = DataExportsApi::DataExport.for(@account).build(user: @user)
|
||||
@dd.save!
|
||||
end
|
||||
|
||||
it "should cancel data export" do
|
||||
user_session(@user)
|
||||
delete "cancel", :format => "json", :account_id => @account.id, :id => @dd.id
|
||||
assert_status(204)
|
||||
@dd.reload.workflow_state.should == "cancelled"
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue