From f790fed434658cc09857625aa93de89ac1728b40 Mon Sep 17 00:00:00 2001 From: pines Date: Fri, 7 Jul 2006 18:18:02 +0000 Subject: [PATCH] handle local perm failures at login git-svn-id: svn://svn.open-ils.org/ILS/trunk@4936 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../staff_client/chrome/content/auth/session.js | 13 ++++----- .../staff_client/chrome/content/util/network.js | 34 ++++++++++++---------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/auth/session.js b/Open-ILS/xul/staff_client/chrome/content/auth/session.js index dd6e462069..a4a20f58cc 100644 --- a/Open-ILS/xul/staff_client/chrome/content/auth/session.js +++ b/Open-ILS/xul/staff_client/chrome/content/auth/session.js @@ -15,6 +15,8 @@ auth.session.prototype = { 'init' : function () { + var obj = this; + try { var init = this.network.request( api.AUTH_INIT.app, @@ -42,11 +44,7 @@ auth.session.prototype = { data.ws_name = params.workstation; data.stash('ws_name'); } - var robj = this.network.request( - api.AUTH_COMPLETE.app, - api.AUTH_COMPLETE.method, - [ params ] - ); + var robj = this.network.simple_request( 'AUTH_COMPLETE', [ params ]); switch (robj.ilsevent) { case 0: @@ -70,7 +68,7 @@ auth.session.prototype = { } break; default: - this.error.standard_unexpected_error_alert('auth.session.init',robj); + obj.error.standard_unexpected_error_alert('auth.session.init',robj); throw(robj); break; } @@ -90,8 +88,7 @@ auth.session.prototype = { } } catch(E) { - var error = 'Error on auth.session.init(): ' + js2JSON(E) + '\n'; - this.error.sdump('D_ERROR',error); + obj.error.standard_unexpected_error_alert('Error on auth.session.init()',E); if (typeof this.on_init_error == 'function') { this.error.sdump('D_AUTH','auth.session.on_init_error()\n'); diff --git a/Open-ILS/xul/staff_client/chrome/content/util/network.js b/Open-ILS/xul/staff_client/chrome/content/util/network.js index 0ff1363c01..03733f213b 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/network.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/network.js @@ -153,7 +153,7 @@ util.network.prototype = { ); JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); - if (data.temporary_session != '') { + if (typeof data.temporary_session != 'undefined' && data.temporary_session != '') { data.session.key = data.temporary_session.key; data.session.authtime = data.temporary_session.authtime; data.stash('session'); @@ -184,7 +184,7 @@ util.network.prototype = { } } } catch(E) { - this.error.sdump('D_ERROR',E); + this.error.standard_unexpected_error_alert('rerequest_on_session_timeout',E); } return req; }, @@ -195,19 +195,23 @@ util.network.prototype = { var robj = req.getResultObject(); if (robj != null && robj.ilsevent && robj.ilsevent == 5000) { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite'); - window.open( - urls.XUL_AUTH_SIMPLE - + '?login_type=temp' - + '&desc_brief=' + window.escape('Permission Denied: ' + robj.ilsperm) - + '&desc_full=' + window.escape('Another staff member with the above permission may authorize this specific action. Please notify your library administrator if you need this permission. If you feel you have received this exception in error, inform your friendly Evergreen developers of the above permission and this debug information: ' + name), - 'simple_auth' + (new Date()).toString(), - 'chrome,resizable,modal,width=700,height=500' - ); - JSAN.use('OpenILS.data'); - var data = new OpenILS.data(); data.init({'via':'stash'}); - if (data.temporary_session != '') { - params[0] = data.temporary_session.key; - req = obj._request(app,name,params,null,o_params); + if (location.href.match(/^chrome/)) { + //alert('Permission denied.'); + } else { + window.open( + urls.XUL_AUTH_SIMPLE + + '?login_type=temp' + + '&desc_brief=' + window.escape('Permission Denied: ' + robj.ilsperm) + + '&desc_full=' + window.escape('Another staff member with the above permission may authorize this specific action. Please notify your library administrator if you need this permission. If you feel you have received this exception in error, inform your friendly Evergreen developers of the above permission and this debug information: ' + name), + 'simple_auth' + (new Date()).toString(), + 'chrome,resizable,modal,width=700,height=500' + ); + JSAN.use('OpenILS.data'); + var data = new OpenILS.data(); data.init({'via':'stash'}); + if (typeof data.temporary_session != 'undefined' && data.temporary_session != '') { + params[0] = data.temporary_session.key; + req = obj._request(app,name,params,null,o_params); + } } } } catch(E) { -- 2.11.0