--- src/app/controllers/portal_pool_controller.rb | 6 ++++ src/app/controllers/provider_controller.rb | 6 ++++ src/app/controllers/realms_controller.rb | 39 +++++++++++++++++++++++++ src/app/models/portal_pool.rb | 4 ++ src/app/views/portal_pool/realms.html.erb | 1 + src/app/views/provider/realms.html.erb | 1 + src/app/views/realms/_list.html.erb | 20 +++++++++++++ src/app/views/realms/index.html.erb | 1 + 8 files changed, 78 insertions(+), 0 deletions(-) create mode 100644 src/app/controllers/realms_controller.rb create mode 100644 src/app/views/portal_pool/realms.html.erb create mode 100644 src/app/views/provider/realms.html.erb create mode 100644 src/app/views/realms/_list.html.erb create mode 100644 src/app/views/realms/index.html.erb
diff --git a/src/app/controllers/portal_pool_controller.rb b/src/app/controllers/portal_pool_controller.rb index 90df8a5..21ceaf2 100644 --- a/src/app/controllers/portal_pool_controller.rb +++ b/src/app/controllers/portal_pool_controller.rb @@ -38,6 +38,12 @@ class PortalPoolController < ApplicationController @instances = @pool.instances end
+ def realms + @pool = PortalPool.find(params[:id]) + @realms = @pool.providers.collect { |pr| pr.realms }.flatten + require_privilege(Privilege::INSTANCE_VIEW,@pool) + end + def new require_privilege(Privilege::POOL_MODIFY) @portal_pool = PortalPool.new diff --git a/src/app/controllers/provider_controller.rb b/src/app/controllers/provider_controller.rb index 53056f5..ac703c0 100644 --- a/src/app/controllers/provider_controller.rb +++ b/src/app/controllers/provider_controller.rb @@ -32,6 +32,12 @@ class ProviderController < ApplicationController require_privilege(Privilege::PROVIDER_VIEW, @provider) end
+ def realms + @provider = Provider.find(params[:id]) + @realms = @provider.realms + require_privilege(Privilege::PROVIDER_VIEW, @provider) + end + def new require_privilege(Privilege::PROVIDER_MODIFY) @provider = Provider.new(params[:provider]) diff --git a/src/app/controllers/realms_controller.rb b/src/app/controllers/realms_controller.rb new file mode 100644 index 0000000..667279c --- /dev/null +++ b/src/app/controllers/realms_controller.rb @@ -0,0 +1,39 @@ +# Copyright (C) 2010 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +# Filters added to this controller apply to all controllers in the application. +# Likewise, all the methods added will be available for all controllers. + +require 'util/taskomatic' + +class RealmsController < ApplicationController + before_filter :require_user + + def index + @realms = Realm.find(:all) + #require_privilege(Privilege::PROVIDER_VIEW, @realms) ? + end + + def new + end + + def create + end + + def delete + end +end diff --git a/src/app/models/portal_pool.rb b/src/app/models/portal_pool.rb index 28b700e..81de037 100644 --- a/src/app/models/portal_pool.rb +++ b/src/app/models/portal_pool.rb @@ -40,6 +40,10 @@ class PortalPool < ActiveRecord::Base :include => [:role], :order => "permissions.id ASC"
+ def providers + cloud_accounts.collect { |ca| ca.provider } + end + def realms realm_list = [] cloud_accounts.each do |cloud_account| diff --git a/src/app/views/portal_pool/realms.html.erb b/src/app/views/portal_pool/realms.html.erb new file mode 100644 index 0000000..3aca533 --- /dev/null +++ b/src/app/views/portal_pool/realms.html.erb @@ -0,0 +1 @@ +<%= render :partial => 'realms/list' %> diff --git a/src/app/views/provider/realms.html.erb b/src/app/views/provider/realms.html.erb new file mode 100644 index 0000000..3aca533 --- /dev/null +++ b/src/app/views/provider/realms.html.erb @@ -0,0 +1 @@ +<%= render :partial => 'realms/list' %> diff --git a/src/app/views/realms/_list.html.erb b/src/app/views/realms/_list.html.erb new file mode 100644 index 0000000..c95fac3 --- /dev/null +++ b/src/app/views/realms/_list.html.erb @@ -0,0 +1,20 @@ +<% if @realms.size == 0 %> +<h1>There are no realms to display</h1> +<% else %> + <table> + <thead> + <tr> + <th scope="col">Name</th> + <th scope="col">Provider</th> + </tr> + </thead> + <tbody> + <%@realms.each {|realm| %> + <tr> + <td><%= realm.name %></td> + <td><%= realm.provider.name %></td> + </tr> + <% } %> + </tbody> + </table> +<% end %> diff --git a/src/app/views/realms/index.html.erb b/src/app/views/realms/index.html.erb new file mode 100644 index 0000000..c19c3fa --- /dev/null +++ b/src/app/views/realms/index.html.erb @@ -0,0 +1 @@ +<%= render :partial => 'list' %>