---
src/app/controllers/application_controller.rb | 7 ++++++
src/app/controllers/catalog_entries_controller.rb | 1 +
src/app/controllers/deployables_controller.rb | 25 +++++++++++++++++++++
src/app/controllers/permissions_controller.rb | 5 ++-
src/app/views/catalog_entries/show.html.haml | 8 ++++--
src/app/views/permissions/_permissions.html.haml | 7 +++--
src/config/routes.rb | 2 +
src/features/catalog_entries.feature | 2 +-
8 files changed, 48 insertions(+), 9 deletions(-)
create mode 100644 src/app/controllers/deployables_controller.rb
diff --git a/src/app/controllers/application_controller.rb
b/src/app/controllers/application_controller.rb
index 56f59d5..0cf9378 100644
--- a/src/app/controllers/application_controller.rb
+++ b/src/app/controllers/application_controller.rb
@@ -282,6 +282,13 @@ class ApplicationController < ActionController::Base
%w[asc desc].include?(params[:order_dir]) ? params[:order_dir] : "asc"
end
+ def add_permissions_inline(perm_obj, path_prefix = "")
+ @permission_object = perm_obj
+ @path_prefix = path_prefix
+ @roles = Role.find_all_by_scope((a)permission_object.class.name)
+ set_permissions_header
+ end
+
def add_permissions_tab(perm_obj, path_prefix = "")
@path_prefix = path_prefix
if "permissions" == params[:details_tab]
diff --git a/src/app/controllers/catalog_entries_controller.rb
b/src/app/controllers/catalog_entries_controller.rb
index 7b6940f..a8adbb6 100644
--- a/src/app/controllers/catalog_entries_controller.rb
+++ b/src/app/controllers/catalog_entries_controller.rb
@@ -56,6 +56,7 @@ class CatalogEntriesController < ApplicationController
save_breadcrumb(catalog_catalog_entry_path((a)catalog_entry.catalog, @catalog_entry),
@catalog_entry.deployable.name)
@providers = Provider.all
@catalogs_options = Catalog.all.map {|c| [c.name, c.id]}
+ add_permissions_inline((a)catalog_entry.deployable)
end
def create
diff --git a/src/app/controllers/deployables_controller.rb
b/src/app/controllers/deployables_controller.rb
new file mode 100644
index 0000000..6e96439
--- /dev/null
+++ b/src/app/controllers/deployables_controller.rb
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2011 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.
+
+class DeployablesController < ApplicationController
+ def show
+ flash.keep
+ @deployable = Deployable.find(params[:id])
+ redirect_to catalog_entry_path((a)deployable.catalog_entries.first)
+ end
+end
diff --git a/src/app/controllers/permissions_controller.rb
b/src/app/controllers/permissions_controller.rb
index 12e3ed6..995b467 100644
--- a/src/app/controllers/permissions_controller.rb
+++ b/src/app/controllers/permissions_controller.rb
@@ -180,6 +180,7 @@ class PermissionsController < ApplicationController
obj_type = params[:permission_object_type]
id = params[:permission_object_id]
@path_prefix = params[:path_prefix]
+ @use_tabs = params[:use_tabs]
unless obj_type or id
@permission_object = BasePermissionObject.general_permission_scope
end
@@ -191,8 +192,8 @@ class PermissionsController < ApplicationController
else
@return_path = send("#{@path_prefix}polymorphic_path",
@permission_object,
- :details_tab => :permissions,
- :only_tab => true)
+ @use_tabs == "yes" ? {:details_tab =>
:permissions,
+ :only_tab => true} : {})
end
require_privilege(required_role, @permission_object)
end
diff --git a/src/app/views/catalog_entries/show.html.haml
b/src/app/views/catalog_entries/show.html.haml
index 5162796..177d494 100644
--- a/src/app/views/catalog_entries/show.html.haml
+++ b/src/app/views/catalog_entries/show.html.haml
@@ -51,6 +51,8 @@
= @catalog_entry.catalog.pool.pool_family.name
- %section.roles
- %header
- %h2= t('.roles')
+ - if check_privilege(Privilege::PERM_VIEW,@permission_object)
+ %section.roles
+ %header
+ %h2= t('users.users')
+ = render :partial => 'permissions/permissions'
diff --git a/src/app/views/permissions/_permissions.html.haml
b/src/app/views/permissions/_permissions.html.haml
index 55c6d9e..8846dd8 100644
--- a/src/app/views/permissions/_permissions.html.haml
+++ b/src/app/views/permissions/_permissions.html.haml
@@ -1,11 +1,12 @@
- content_for :form_header do
- if check_privilege(Privilege::PERM_SET)
- %li= link_to t('permissions.form.grant_access'),
new_permission_path(:permission_object_type => @permission_object.class.name,
:permission_object_id => @permission_object.id, :path_prefix => @path_prefix), {
:class => 'button primary', :id => 'new_permission_button'}
+ %li= link_to t('permissions.form.grant_access'),
new_permission_path(:permission_object_type => @permission_object.class.name,
:permission_object_id => @permission_object.id, :path_prefix => @path_prefix,
:use_tabs => @use_tabs ? @use_tabs : (@tabs ? 'yes' : 'no')), { :class
=> 'button primary', :id => 'new_permission_button'}
%li= restful_submit_tag t('permissions.revoke_access'), "destroy",
multi_destroy_permissions_path, 'DELETE', :id => 'revoke_button',
:class => 'button danger'
- %li= restful_submit_tag t('edit'), "multi_update",
multi_update_permissions_path, 'POST', :id => 'edit_button', :class
=> 'hidden'
+ %li= restful_submit_tag t('edit'), "multi_update",
multi_update_permissions_path, 'POST', :id => 'perm_edit_button',
:class => 'hidden'
= hidden_field_tag :permission_object_type, @permission_object.class.name
= hidden_field_tag :permission_object_id, @permission_object.id
= hidden_field_tag :path_prefix, @path_prefix
+ = hidden_field_tag :use_tabs, @use_tabs ? @use_tabs : (@tabs ? 'yes' :
'no')
= filter_table(@permission_list_header, @permission_object.permissions) do |permission|
%tr{:class => cycle('nostripe','stripe')}
@@ -19,7 +20,7 @@
- if check_privilege(Privilege::PERM_SET)
%td= select_tag "permission_role_selected[]",
options_for_select((a)roles.map {|r| [ r.name, "#{permission.id},#{r.id}" ] },
:selected => "#{permission.id},#{permission.role.id}", :disabled =>
@permission_object.permissions.where(["user_id = ? and role_id != ?",
permission.user_id, permission.role_id]).collect {|p|
"#{permission.id},#{p.role.id}"}), :id =>
"permission_role_selected_#{permission.id}"
:javascript
- $("#permission_role_selected_#{permission.id}").change(function () {
$("#edit_button").click(); } );
+ $("#permission_role_selected_#{permission.id}").change(function () {
$("#perm_edit_button").click(); } );
-else
%td= permission.role.name
diff --git a/src/config/routes.rb b/src/config/routes.rb
index 81c5112..515d6b7 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -210,6 +210,8 @@ Conductor::Application.routes.draw do
resources :catalog_entries
+ resources :deployables
+
resources :images do
collection do
post 'edit_xml'
diff --git a/src/features/catalog_entries.feature b/src/features/catalog_entries.feature
index 80893fa..d950c50 100644
--- a/src/features/catalog_entries.feature
+++ b/src/features/catalog_entries.feature
@@ -40,7 +40,7 @@ Feature: Manage Catalog Entries
And I should see "Image"
And I should see "Build"
And I should see "Catalogs"
- And I should see "Roles"
+ And I should see "Users"
Scenario: Launch a deployment
Given there is a "default" catalog
--
1.7.6.4