From 9dcc61e8bacdf9a506649f08d2e9240926a62e37 Mon Sep 17 00:00:00 2001 From: Charles du Jeu Date: Wed, 24 Feb 2010 08:39:39 +0000 Subject: [PATCH] clear/load data on userChange in editorPrefPane git-svn-id: https://svn.argeo.org/commons/trunk@3393 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../org/argeo/security/ria/components/UserEditor.js | 6 ++++++ .../security/ria/components/UserEditorPrefPane.js | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/UserEditor.js b/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/UserEditor.js index 9d7f299a0..93079d0cd 100644 --- a/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/UserEditor.js +++ b/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/UserEditor.js @@ -343,6 +343,12 @@ qx.Class.define("org.argeo.security.ria.components.UserEditor", userDataService.send(); }, + clearUserData : function(){ + this.usernameField.setValue(""); + this.rolesField.setValue([]); + this.removeAllTabs(); + }, + partialRefreshUser : function(user, target){ if(!qx.lang.Type.isArray(target)) target = [target]; diff --git a/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/UserEditorPrefPane.js b/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/UserEditorPrefPane.js index 395a67eed..ae1dbb3eb 100644 --- a/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/UserEditorPrefPane.js +++ b/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/UserEditorPrefPane.js @@ -10,7 +10,15 @@ qx.Class.define("org.argeo.security.ria.components.UserEditorPrefPane", { var saveButton = new qx.ui.form.Button("Save", "org.argeo.security.ria/document-save.png"); saveButton.addListener("execute", this.saveUser, this); this.buttonGB.add(saveButton); - this.loadUserData(org.argeo.ria.session.AuthService.getInstance().getUser()); + var authService = org.argeo.ria.session.AuthService.getInstance(); + this.loadUserData(authService.getUser()); + authService.addListener("changeUser", function(){ + if(authService.getUser() == "anonymous"){ + this.clearUserData(); + }else{ + this.loadUserData(authService.getUser()); + } + }, this); }, members : { -- 2.30.2