clear/load data on userChange in editorPrefPane
authorCharles du Jeu <charles.dujeu@gmail.com>
Wed, 24 Feb 2010 08:39:39 +0000 (08:39 +0000)
committerCharles du Jeu <charles.dujeu@gmail.com>
Wed, 24 Feb 2010 08:39:39 +0000 (08:39 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@3393 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/UserEditor.js
security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/UserEditorPrefPane.js

index 9d7f299a03549cc21e45c83066547097fd626a72..93079d0cda68731bdaa586cec0a53a044b946fb0 100644 (file)
@@ -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];
                
index 395a67eed4e1a1ca7fc864c1c7c75fe5bde9ad00..ae1dbb3eb58f3c2c9158bab47de1f58b8bb9b0db 100644 (file)
@@ -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");\r
                saveButton.addListener("execute", this.saveUser, this);\r
                this.buttonGB.add(saveButton);\r
-               this.loadUserData(org.argeo.ria.session.AuthService.getInstance().getUser());\r
+               var authService = org.argeo.ria.session.AuthService.getInstance();\r
+               this.loadUserData(authService.getUser());\r
+               authService.addListener("changeUser", function(){\r
+                       if(authService.getUser() == "anonymous"){\r
+                               this.clearUserData();\r
+                       }else{\r
+                               this.loadUserData(authService.getUser());\r
+                       }\r
+               }, this);\r
        },\r
        \r
        members : {\r