back-compat global population
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 23 Apr 2008 02:03:48 +0000 (02:03 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 23 Apr 2008 02:03:48 +0000 (02:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@9435 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/User.js

index 8f5442e..6039dc0 100644 (file)
@@ -35,13 +35,14 @@ if(!dojo._hasResource["openils.User"]) {
         constructor : function ( kwargs ) {
             this.id = kwargs.id;
             this.user = kwargs.user;
-            this.authtoken = kwargs.authtoken;
-            this.authtime = kwargs.authtime;
+            this.passwd = kwargs.passwd;
+            this.authtoken = kwargs.authtoken || openils.User.authtoken;
+            this.authtime = kwargs.authtime || openils.User.authtime;
             this.login_type = kwargs.login_type;
             this.location = kwargs.location;
 
-            if (this.id && this.authtoken) this.getById();
-            else if (this.authtoken) this.getBySession();
+            if (this.authtoken) this.getBySession();
+            else if (this.id && this.authtoken) this.user = this.getById( this.id );
             else if (kwargs.login) this.login();
 
         },
@@ -53,6 +54,7 @@ if(!dojo._hasResource["openils.User"]) {
                 req.oncomplete = function(r) {
                     var user = r.recv().content();
                     _u.user = user;
+                                       if (!openils.User.user) !openils.User.user = _u.user;
                     if(onComplete)
                         onComplete(user);
                 }
@@ -107,7 +109,9 @@ if(!dojo._hasResource["openils.User"]) {
                 authReq.oncomplete = function(rr) {
                     var data = rr.recv().content();
                     _u.authtoken = data.payload.authtoken;
+                                       if (!openils.User.authtoken) !openils.User.authtoken = _u.authtoken;
                     _u.authtime = data.payload.authtime;
+                                       if (!openils.User.authtime) !openils.User.authtime = _u.authtime;
                     _u.getBySession(onComplete);
                 }
                 authReq.send();
@@ -199,6 +203,11 @@ if(!dojo._hasResource["openils.User"]) {
         }
 
     });
+
+       openils.User.user = null;
+       openils.User.authtoken = null;
+       openils.User.authtime = null;
+
 }