There is indeed a getRoleList service
[lgpl/argeo-commons.git] / security / runtime / org.argeo.security.ria / src / argeo-ria-lib / security / class / org / argeo / security / ria / RolesApplet.js
index da45d965bb08421cee79f69f2e5fad8c96b42fb4..3533221af41a90ee4aed32c0b57b47721005acb8 100644 (file)
@@ -263,10 +263,11 @@ qx.Class.define("org.argeo.security.ria.RolesApplet",
                        return;
                }
                var uniqueValue = this._selectionToValues(selectionModel)[0];
-               var initSelection = this.rolesUsersStub[uniqueValue];
+               //var initSelection = this.rolesUsersStub[uniqueValue];
+               this.usersAppletReference.applySelection(uniqueValue, "roles");
+               var initSelection = this.usersAppletReference.getViewSelection().getNodes(); 
                this.setChooserOriginalSelection(initSelection);
                this.setChooserSelectionModified(false);
-               this.usersAppletReference.applySelection(initSelection, "username");
                this.saveButton.setEnabled(false);
        },
        
@@ -304,9 +305,15 @@ qx.Class.define("org.argeo.security.ria.RolesApplet",
         * Load a given row : the data passed must be a simple data array.
         * @param data {Element} The text xml description. 
         */
-       load : function(){              
-               var data = [["ROLE_ADMIN"],["ROLE_USER"]];
-               this.tableModel.setData(data);
+       load : function(){
+               
+               var service = org.argeo.security.ria.SecurityAPI.getListRolesService();
+               service.addListener("completed", function(response){
+                       var data = [];
+                       response.getContent().forEach(function(el){data.push([el]);});
+                       this.tableModel.setData(data);                          
+               }, this);
+               service.send();
                
                var commands = this.getCommands();
                this.toolBarPart.add(commands["new_role"].command.getToolbarButton());