X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=security%2Fruntime%2Forg.argeo.security.ria%2Fsrc%2Fargeo-ria-lib%2Fsecurity%2Fclass%2Forg%2Fargeo%2Fsecurity%2Fria%2FUsersApplet.js;h=6a00e787cdcb9d2b82db3826169e907063761cc2;hb=f7c73e12f9534b0b796686e207dd4b43193977fa;hp=a44d3bb06bcc1edf50c28d3464bc074e24cf6c6f;hpb=887773721e5ce1aabbd45b8fc1278ffcf6bb25f8;p=lgpl%2Fargeo-commons.git diff --git a/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/UsersApplet.js b/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/UsersApplet.js index a44d3bb06..6a00e787c 100644 --- a/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/UsersApplet.js +++ b/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/UsersApplet.js @@ -28,6 +28,18 @@ qx.Class.define("org.argeo.security.ria.UsersApplet", */ commands : { init : { + "load_users" : { + label : "Reload Users", + icon : "org.argeo.security.ria/view-refresh.png", + shortcut : "Control+h", + enabled : true, + menu : "Users", + toolbar : "users", + callback : function(e){ + this.loadUsersList(); + }, + command : null + }, "new_user" : { label : "New User", icon : "org.argeo.security.ria/list-add.png", @@ -73,9 +85,10 @@ qx.Class.define("org.argeo.security.ria.UsersApplet", callback : function(e){ // Call service to delete var crtUser = this.getViewSelection().getNodes()[0]; + var userObject = this.getUsersList()[crtUser]; var classObj = org.argeo.security.ria.UserEditorApplet; var iView = org.argeo.ria.components.ViewsManager.getInstance().initIViewClass(classObj, "editor", crtUser); - iView.load(crtUser); + iView.load(userObject); }, selectionChange : function(viewName, data){ if(viewName != "users") return; @@ -95,6 +108,15 @@ qx.Class.define("org.argeo.security.ria.UsersApplet", nullable:false, check:"org.argeo.ria.components.ViewSelection" }, + usersList : { + check : "Map", + apply : "_applyUsersList", + event : "changeUsersList" + }, + rolesList : { + check : "Array", + event : "changeRolesList" + }, instanceId : {init:""}, instanceLabel : {init:""} }, @@ -132,19 +154,20 @@ qx.Class.define("org.argeo.security.ria.UsersApplet", this.table.addListener("cellDblclick", function(cellEvent){ this.getCommands()["edit_user"].command.execute(); }, this); - - this.setGuiMode("chooser"); + + this.setUsersList({}); + this.setGuiMode("clear"); }, _applyGuiMode : function(newMode, oldMode){ this.table.getSelectionModel().clearSelection(); this.resetHiddenRows(); if(newMode == "filter"){ - this.table.getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.SINGLE_INTERVAL_SELECTION); + this.table.getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.SINGLE_SELECTION); }else if(newMode == "chooser"){ this.table.getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.MULTIPLE_INTERVAL_SELECTION_TOGGLE); }else if(newMode == "clear"){ - this.table.getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.SINGLE_INTERVAL_SELECTION); + this.table.getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.SINGLE_SELECTION); } }, @@ -175,27 +198,53 @@ qx.Class.define("org.argeo.security.ria.UsersApplet", * @param data {Element} The text xml description. */ load : function(){ - var data = [["root", "ROLE_ADMIN"], ["mbaudier", "ROLE_ADMIN,ROLE_USER"], ["cdujeu","ROLE_USER"], ["anonymous", ""]]; - this.tableModel.setData(data); var commands = this.getCommands(); this.toolBarPart.add(commands["new_user"].command.getToolbarButton()); this.toolBarPart.add(commands["delete_user"].command.getToolbarButton()); this.toolBarPart.add(commands["edit_user"].command.getToolbarButton()); this.toolBar.setShow("icon"); - + this.loadUsersList(); }, - applySelection : function(selectionValues, target){ + loadUsersList : function(){ + var request = org.argeo.security.ria.SecurityAPI.getListUsersService(); + request.addListener("completed", function(response){ + var jSon = response.getContent(); + var usMap = {}; + for(var i=0;i