Permissions are requested just before the permissions dialog is displayed
[pithos-web-client] / src / gr / grnet / pithos / web / client / commands / AddUserCommand.java
index c82874c..075fb5a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011 GRNET S.A. All rights reserved.
+ * Copyright 2011-2012 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -79,17 +79,18 @@ public class AddUserCommand implements Command {
                PostRequest updateGroup = new PostRequest(app.getApiPath(), app.getUsername(), path) {
                                
                                @Override
-                               public void onSuccess(@SuppressWarnings("unused") Resource result) {
+                               public void onSuccess(Resource result) {
                                        app.updateGroupNode(group);
                                }
                                
                                @Override
                                public void onError(Throwable t) {
                                        GWT.log("", t);
+                                       app.setError(t);
                                        if (t instanceof RestException) {
                                                app.displayError("Unable to update group:" + ((RestException) t).getHttpStatusText());
                                        }
-                                       else
+                                       else 
                                                app.displayError("System error updating group:" + t.getMessage());
                                }
 
@@ -101,7 +102,7 @@ public class AddUserCommand implements Command {
                        updateGroup.setHeader("X-Auth-Token", app.getToken());
                        String groupMembers = "";
                        for (String u : group.getMembers())
-                               groupMembers += (u + ",");
+                               groupMembers += (URL.encodePathSegment(u) + ",");
                        updateGroup.setHeader("X-Account-Group-" + URL.encodePathSegment(group.getName()), groupMembers);
                        Scheduler.get().scheduleDeferred(updateGroup);
         }