On 01/31/2011 10:28 AM, mtaylor(a)redhat.com wrote:
From: Martyn Taylor<mtaylor(a)redhat.com>
---
.../admin/hardware_profiles_controller.rb | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/admin/hardware_profiles_controller.rb
b/src/app/controllers/admin/hardware_profiles_controller.rb
index dea2cac..d8de549 100644
--- a/src/app/controllers/admin/hardware_profiles_controller.rb
+++ b/src/app/controllers/admin/hardware_profiles_controller.rb
@@ -1,5 +1,5 @@
class Admin::HardwareProfilesController< ApplicationController
- before_filter :require_user
+ before_filter :require_user, :except => :matching_profiles
Similar comment
here to the other patch -- we should keep any
differences in auth between API calls and UI actions within require_user
rather than repeating the differences across the controllers.
before_filter :set_params_and_header, :only => [:index,
:show]
before_filter :load_hardware_profiles, :only => [:index, :show]
before_filter :load_hardware_profile, :only => [:show]
@@ -98,6 +98,18 @@ class Admin::HardwareProfilesController< ApplicationController
redirect_to admin_hardware_profiles_path
end
+ def matching_profiles
+ begin
+ hwp = HardwareProfile.find(params[:id])
+ hwps = HardwareProfile.matching_hwps(hwp)
+ render :layout => false, :xml => hwps.to_xml
+ rescue ActiveRecord::RecordNotFound
+ head :not_found
+ rescue Exception
+ head :internal_server_error
+ end
+ end
+
private
def setup_new_hardware_profile
if params[:hardware_profile]
Scott