@@ -112,13 +118,30 @@ class Admin::ProviderAccountsController < ApplicationController
if (not params[:accounts_selected]) or (params[:accounts_selected].length == 0)
flash[:notice] = "You must select some accounts first."
else
- CloudAccount.find(params[:accounts_selected]).each do |account|
+ ProviderAccount.find(params[:accounts_selected]).each do |account|
account.destroy if check_privilege(Privilege::MODIFY, account)
end
end
redirect_to admin_provider_accounts_url
end
+ def set_selected_provider
+ @quota = Quota.new
+ @provider_account = ProviderAccount.new
+ respond_to do |format|
+ format.js {
+ @providers = Provider.find(:all)
+ @selected_provider = Provider.find(params[:select_provider])
+ render :partial => 'provider_selection'
+ }
+ format.html {
+ @providers = Provider.find(:all)
+ @selected_provider = Provider.find(params[:select_provider])
+ render :action => 'new', :layout => true
+ }
+ end
+ end
+
protected
def test_account(account)
diff --git a/src/db/migrate/20110117140824_rename_cloud_account_to_provider_account.rb b/src/db/migrate/20110117140824_rename_cloud_account_to_provider_account.rb
new file mode 100644
index 0000000..beaabc5
--- /dev/null
+++ b/src/db/migrate/20110117140824_rename_cloud_account_to_provider_account.rb
@@ -0,0 +1,11 @@
+class RenameCloudAccountToProviderAccount < ActiveRecord::Migration
+ def self.up
+ rename_table (:cloud_accounts,:provider_accounts)
+ change_column (:providers, :cloud_type, :integer, :null => false)
+ end
+
+ def self.down
+ change_column (:providers, :cloud_type, :string, :null => false)
+ rename_table (:provider_accounts, :cloud_accounts)
+ end
+end
diff --git a/src/db/seeds.rb b/src/db/seeds.rb
index 9a6065c..1ed2329 100644
--- a/src/db/seeds.rb
+++ b/src/db/seeds.rb
@@ -30,17 +30,17 @@ roles =
Quota => [VIEW]}},
Provider =>
{"Provider Owner" => {Provider => [VIEW, MOD, VPRM,GPRM],
- CloudAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM]}},
- CloudAccount =>
- {"Provider Account User" => {CloudAccount => [VIEW,USE]},
- "Provider Account Owner" => {CloudAccount => [VIEW,USE,MOD, VPRM,GPRM]}},
+ ProviderAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM]}},
+ ProviderAccount =>
+ {"Provider Account User" => {ProviderAccount => [VIEW,USE]},
+ "Provider Account Owner" => {ProviderAccount => [VIEW,USE,MOD, VPRM,GPRM]}},
Template =>
{"Template User" => {Template => [VIEW,USE]},
"Template Owner" => {Template => [VIEW,USE,MOD, VPRM,GPRM]}},
BasePermissionObject =>
{"Provider Creator" => {Provider => [ CRE]},
"Provider Administrator" => {Provider => [VIEW, MOD,CRE,VPRM,GPRM],
- CloudAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM]},
+ ProviderAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM]},
"HWP Administrator" => {HardwareProfile => [ MOD,CRE,VPRM,GPRM]},
"Realm Administrator" => {Realm => [ USE,MOD,CRE,VPRM,GPRM]},
"Pool Creator" => {Pool => [ CRE]},
@@ -50,7 +50,7 @@ roles =
PoolFamily => [VIEW, MOD,CRE,VPRM,GPRM]},
"Template Administrator" => {Template => [VIEW,USE,MOD,CRE,VPRM,GPRM]},
"Administrator" => {Provider => [VIEW, MOD,CRE,VPRM,GPRM],
- CloudAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM],
+ ProviderAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM],
HardwareProfile => [ MOD,CRE,VPRM,GPRM],
Realm => [ USE,MOD,CRE,VPRM,GPRM],
User => [VIEW, MOD,CRE],
You'll need to edit the existing Roles and Privileges objects in a
migration to make the corresponding change. Without this, running
'rake db:migrate' won't work as the roles and privileges data
(previously loaded via seeds.rb) will be wrong.