[PATCH conductor 2/2] Adding persmission filter when displaying deployment

ifarkas at redhat.com ifarkas at redhat.com
Thu Feb 23 12:31:41 UTC 2012


From: Imre Farkas <ifarkas at redhat.com>

---
 src/app/controllers/pools_controller.rb |    3 ++-
 src/app/models/pool.rb                  |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/app/controllers/pools_controller.rb b/src/app/controllers/pools_controller.rb
index 2d587f6..f53bfdb 100644
--- a/src/app/controllers/pools_controller.rb
+++ b/src/app/controllers/pools_controller.rb
@@ -1,4 +1,5 @@
 #
+#
 #   Copyright 2011 Red Hat, Inc.
 #
 #   Licensed under the Apache License, Version 2.0 (the "License");
@@ -105,7 +106,7 @@ class PoolsController < ApplicationController
     respond_to do |format|
       format.html { render :action => :show}
       format.js { render :partial => @view }
-      format.json { render :json => @pool.as_json(:with_deployments => true) }
+      format.json { render :json => @pool.as_json(:with_deployments => true, :current_user => current_user) }
     end
   end
 
diff --git a/src/app/models/pool.rb b/src/app/models/pool.rb
index b1fc41e..be3d156 100644
--- a/src/app/models/pool.rb
+++ b/src/app/models/pool.rb
@@ -123,7 +123,7 @@ class Pool < ActiveRecord::Base
     })
 
     if options[:with_deployments]
-      result[:deployments] = deployments.map {|d| d.as_json}
+      result[:deployments] = deployments.list_for_user(options[:current_user], Privilege::VIEW).map {|d| d.as_json}
     end
 
     result
-- 
1.7.6.5




More information about the aeolus-devel mailing list