From 9b30934a241f058465df1f6ef60e99ff74b4c692 Mon Sep 17 00:00:00 2001 From: miker Date: Wed, 23 Apr 2008 02:03:48 +0000 Subject: [PATCH] back-compat global population git-svn-id: svn://svn.open-ils.org/ILS/trunk@9435 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/openils/User.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/User.js b/Open-ILS/web/js/dojo/openils/User.js index 8f5442e12a..6039dc0fe3 100644 --- a/Open-ILS/web/js/dojo/openils/User.js +++ b/Open-ILS/web/js/dojo/openils/User.js @@ -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; + } -- 2.43.2