[PATCH conductor] Permissions page for deployables.
by Scott Seago
---
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
12 years, 5 months
[PATCH] Remove extra console in libvirt XML declaration to enable Oz on libvirt 0.9.7
by Steven Dake
Libvirt 0.9.7 causes oz to fail with the error:
from: /var/log/libvirt/libvirtd.log:
2011-11-29 20:00:07.063 +0000: 1243: error : virDomainDefParseXML:7265 : unsupported configuration: Only the first console can be a serial port
Signed-off-by: Steven Dake <sdake(a)redhat.com>
---
oz/Guest.py | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/oz/Guest.py b/oz/Guest.py
index 547efd7..add164c 100644
--- a/oz/Guest.py
+++ b/oz/Guest.py
@@ -360,9 +360,6 @@ class Guest(object):
# create devices
devices = domain.newChild(None, "devices", None)
- # console
- console = devices.newChild(None, "console", None)
- console.setProp("device", "pty")
# graphics
graphics = devices.newChild(None, "graphics", None)
graphics.setProp("port", "-1")
--
1.7.7.3
12 years, 5 months
[PATCH conductor 0/1] #758424 error message fix
by Matt Wagner
This is a trivial little fix, but it was irritating me. We weren't joining deployment names if you deleted several, so they got mashed together in an unreadable mess.
Rather than using .join(', '), I'm using the spiffy to_sentence method: http://apidock.com/rails/Array/to_sentence -- it's supposedly internationalized based on a given locale's use of list separators and the translated word 'and'. It might be nifty to start using this everywhere.
>> ['Tom', 'Dick', 'Harry'].to_sentence
=> "Tom, Dick, and Harry"
I also changed the .join(', ') immediately above the line I was fixing, to be consistent. I'm not about to go through the app changing all instances, though...
Self-pushing, just wanted to send notice to the list.
-- Matt
12 years, 5 months
[PATCH conductor] Remove secret_token.rb from conductor rpm - v2
by Richard Su
We don't want to include the secret_token.rb file in our rpms because
it becomes a security hole if people end up using it in production.
A companion configure patch is on list to regenerate a new token each
time aeolus-configure is executed.
---
aeolus-conductor.spec.in | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/aeolus-conductor.spec.in b/aeolus-conductor.spec.in
index 6db6480..b40f479 100644
--- a/aeolus-conductor.spec.in
+++ b/aeolus-conductor.spec.in
@@ -178,6 +178,7 @@ for filetype in builder css feature gif haml html ico jpg js json key opts png \
%{__cp} src/$dir/*.$filetype %{buildroot}%{app_root}/$dir
done
done
+%{__rm} %{buildroot}%{app_root}/config/initializers/secret_token.rb
# precompile stylesheets
%{__mkdir} %{buildroot}%{app_root}/public/stylesheets/compiled
--
1.7.6.4
12 years, 5 months