Scott Seago
2008-Aug-13 20:46 UTC
[Ovirt-devel] [PATCH] Fixed bug in adding user permissions. Code wasn't sending a properly formatted json response, and the error response was redirecting rather than sending json.
Signed-off-by: Scott Seago <sseago at redhat.com>
---
wui/src/app/controllers/permission_controller.rb | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/wui/src/app/controllers/permission_controller.rb
b/wui/src/app/controllers/permission_controller.rb
index 4367275..813d9d9 100644
--- a/wui/src/app/controllers/permission_controller.rb
+++ b/wui/src/app/controllers/permission_controller.rb
@@ -61,10 +61,11 @@ class PermissionController < ApplicationController
else
begin
@permission.save_with_new_children
- render :json => "created User Permissions for
#{@permission.uid}".to_json
+ render :json => { :object => "permission", :success
=> true,
+ :alert => "created User Permissions for
#{@permission.uid}." }
rescue
- # FIXME: need to handle proper error messages w/ ajax
- render :action => 'new'
+ render :json => { :object => "permission", :success
=> false,
+ :alert => "Error adding user: #{$!}" }
end
end
end
--
1.5.5.1