[open-ils-commits] r9435 - trunk/Open-ILS/web/js/dojo/openils

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Apr 22 22:42:58 EDT 2008


Author: miker
Date: 2008-04-22 22:03:48 -0400 (Tue, 22 Apr 2008)
New Revision: 9435

Modified:
   trunk/Open-ILS/web/js/dojo/openils/User.js
Log:
back-compat global population

Modified: trunk/Open-ILS/web/js/dojo/openils/User.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/User.js	2008-04-23 01:45:21 UTC (rev 9434)
+++ trunk/Open-ILS/web/js/dojo/openils/User.js	2008-04-23 02:03:48 UTC (rev 9435)
@@ -35,13 +35,14 @@
         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 @@
                 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 @@
                 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 @@
         }
 
     });
+
+	openils.User.user = null;
+	openils.User.authtoken = null;
+	openils.User.authtime = null;
+
 }
 
 



More information about the open-ils-commits mailing list