Menu

#3 configurable not-authorized behavior

open-accepted
5
2006-11-06
2006-11-06
Dell Sala
No

I made this modification to mybic for my own apps to
allow for a configuratble not-authorized behavior.

I've found that in most cases I want unauthorized
requests to have the same result. It's usually
something like displaying an alert message or
redirecting the browser to a login page. Rather than
having to check for an unauthrorized response in my
every js handler function I thought it would be simpler
to specify a function that would automatically be
called for an unauthorized response. Here's an example:

var ajaxObj = new XMLHTTP('mybic_server.php');

ajaxObj.not_authorized_func = denyAccess;

function denyAccess () {
alert('You are not authorized');
window.location = "login.php";
}

if ajaxObj.not_authorized_func is not specified the
behavior continues to the current mybic behavior.

I've attached a simple patch if you like this idea.

Discussion

  • Dell Sala

    Dell Sala - 2006-11-06

    Patch for adding not_authorized_func API

     
  • Jim Plush

    Jim Plush - 2006-11-06
    • assigned_to: nobody --> jplush76
    • status: open --> open-accepted
     
  • Jim Plush

    Jim Plush - 2006-11-06

    Logged In: YES
    user_id=1491998

    I'll add this for the 1.0 release, thanks Dell

     

Log in to post a comment.