From: Jiri Tomasek jtomasek@redhat.com
--- .../controllers/admin/realm_mappings_controller.rb | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/app/controllers/admin/realm_mappings_controller.rb b/src/app/controllers/admin/realm_mappings_controller.rb index 26b156a..929a609 100644 --- a/src/app/controllers/admin/realm_mappings_controller.rb +++ b/src/app/controllers/admin/realm_mappings_controller.rb @@ -22,9 +22,15 @@ class Admin::RealmMappingsController < ApplicationController
def multi_destroy require_privilege(Privilege::MODIFY, Realm) - # TODO: add permissions checks - destroyed = RealmBackendTarget.destroy(params[:id]) - redirect_to admin_realm_path(destroyed.first.frontend_realm_id, :details_tab => 'mapping') + if params[:id].blank? + flash[:error] = 'You must select at least one mapping to delete.' + redirect_to admin_realm_path(params[:frontend_realm_id], :details_tab => 'mapping') + #redirect_to admin_realms_path + else + # TODO: add permissions checks + destroyed = RealmBackendTarget.destroy(params[:id]) + redirect_to admin_realm_path(destroyed.first.frontend_realm_id, :details_tab => 'mapping') + end end
protected
ACK to both patches with a small nit in this one (inline).
On 03/30/2011 10:14 AM, jtomasek@redhat.com wrote:
From: Jiri Tomasekjtomasek@redhat.com
.../controllers/admin/realm_mappings_controller.rb | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/app/controllers/admin/realm_mappings_controller.rb b/src/app/controllers/admin/realm_mappings_controller.rb index 26b156a..929a609 100644 --- a/src/app/controllers/admin/realm_mappings_controller.rb +++ b/src/app/controllers/admin/realm_mappings_controller.rb @@ -22,9 +22,15 @@ class Admin::RealmMappingsController< ApplicationController
def multi_destroy require_privilege(Privilege::MODIFY, Realm)
- # TODO: add permissions checks
- destroyed = RealmBackendTarget.destroy(params[:id])
- redirect_to admin_realm_path(destroyed.first.frontend_realm_id, :details_tab => 'mapping')
- if params[:id].blank?
flash[:error] = 'You must select at least one mapping to delete.'
redirect_to admin_realm_path(params[:frontend_realm_id], :details_tab => 'mapping')
#redirect_to admin_realms_path
I think you may delete this line ^
else
# TODO: add permissions checks
destroyed = RealmBackendTarget.destroy(params[:id])
redirect_to admin_realm_path(destroyed.first.frontend_realm_id, :details_tab => 'mapping')
end end
protected
From: Jiri Tomasek jtomasek@redhat.com
--- src/features/realm.feature | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/features/realm.feature b/src/features/realm.feature index d0d517a..0cb2b85 100644 --- a/src/features/realm.feature +++ b/src/features/realm.feature @@ -61,3 +61,11 @@ Feature: Manage Realms When I press "Delete" Then I should be on the admin realms page And I should see "You must select at least one realm to delete." + + Scenario: Delete realm mapping without selecting one + Given I am on the admin realms page + And there is a realm "testrealm1" + When I follow "testrealm1" + And I follow "Mapping" + And I press "Delete" within "#details-view" + Then I should see "You must select at least one mapping to delete"
aeolus-devel@lists.fedorahosted.org