fixes a problem in the move (and add pool to smart pool) dialogs when permission was granted to the top level DirectoryPool rather than to individual HW pools. This code will be going away soon anyway, as we need to migrate the dialog tree view away from the legacy implementation to jguiditta's new tree code. This fixes BZ 464273 and 464398. Signed-off-by: Scott Seago <sseago at redhat.com> --- src/app/controllers/hardware_controller.rb | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/app/controllers/hardware_controller.rb b/src/app/controllers/hardware_controller.rb index 42ff9cb..9c04210 100644 --- a/src/app/controllers/hardware_controller.rb +++ b/src/app/controllers/hardware_controller.rb @@ -76,6 +76,14 @@ class HardwareController < PoolController open_list = [] else pools = Pool.list_for_user(get_login_user,Permission::PRIV_VIEW) + hw_root = HardwarePool.get_default_pool + if !(pools.include?(hw_root)) + if pools.include?(DirectoryPool.get_directory_root) + pools << hw_root + elsif pools.include?(DirectoryPool.get_hardware_root) + pools << hw_root + end + end current_id = params[:current_id] if current_id current_pool = Pool.find(current_id) -- 1.5.5.1
On Tue, 2008-10-07 at 10:30 -0400, Scott Seago wrote:> fixes a problem in the move (and add pool to smart pool) dialogs when permission was granted to the top level DirectoryPool rather than to individual HW pools. This code will be going away soon anyway, as we need to migrate the dialog tree view away from the legacy implementation to jguiditta's new tree code. > > This fixes BZ 464273 and 464398. > > Signed-off-by: Scott Seago <sseago at redhat.com> > --- > src/app/controllers/hardware_controller.rb | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/src/app/controllers/hardware_controller.rb b/src/app/controllers/hardware_controller.rb > index 42ff9cb..9c04210 100644 > --- a/src/app/controllers/hardware_controller.rb > +++ b/src/app/controllers/hardware_controller.rb > @@ -76,6 +76,14 @@ class HardwareController < PoolController > open_list = [] > else > pools = Pool.list_for_user(get_login_user,Permission::PRIV_VIEW) > + hw_root = HardwarePool.get_default_pool > + if !(pools.include?(hw_root)) > + if pools.include?(DirectoryPool.get_directory_root) > + pools << hw_root > + elsif pools.include?(DirectoryPool.get_hardware_root) > + pools << hw_root > + end > + end > current_id = params[:current_id] > if current_id > current_pool = Pool.find(current_id)ACK. This works for me in both cases noted in the BZs
Scott Seago wrote:> fixes a problem in the move (and add pool to smart pool) dialogs when permission was granted to the top level DirectoryPool rather than to individual HW pools. This code will be going away soon anyway, as we need to migrate the dialog tree view away from the legacy implementation to jguiditta's new tree code. > > This fixes BZ 464273 and 464398. > > Signed-off-by: Scott Seago <sseago at redhat.com> > --- > src/app/controllers/hardware_controller.rb | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/src/app/controllers/hardware_controller.rb b/src/app/controllers/hardware_controller.rb > index 42ff9cb..9c04210 100644 > --- a/src/app/controllers/hardware_controller.rb > +++ b/src/app/controllers/hardware_controller.rb > @@ -76,6 +76,14 @@ class HardwareController < PoolController > open_list = [] > else > pools = Pool.list_for_user(get_login_user,Permission::PRIV_VIEW) > + hw_root = HardwarePool.get_default_pool > + if !(pools.include?(hw_root)) > + if pools.include?(DirectoryPool.get_directory_root) > + pools << hw_root > + elsif pools.include?(DirectoryPool.get_hardware_root) > + pools << hw_root > + end > + endMinor nit, in that you could get rid of a redundant "pools << hw_root" line by doing "if pools.include?(...get_directory_root) or pool.include?(...get_hardware_root)", but it's very minor. If this code is going away soon anyway, then no big deal, and... ACK -- Chris Lalancette