vendredi 5 décembre 2014

How to determine authenticated status on client side?



Do you know any syncronous way to get IsAuthenticated status for currentRequest in client side via javascript?


I can get current user via client model, but it will be asynchronous.



this.authenticationPending = true;
this.isAuthenticated = false;

ExecuteOrDelayUntilScriptLoaded(Function.createDelegate(this, function() {
var context = new SP.ClientContext.get_current();
this.website = context.get_web();
this.currentUser = website.get_currentUser();
context.load(currentUser);
context.executeQueryAsync(
Function.createDelegate(this, function ()
{
this.authenticationPending = false;
this.isAuthenticated = this.currentUser.get_id() > 0;
}),
Function.createDelegate(this, function ()
{
this.authenticationPending = false;
this.isAuthenticated = false;
}));
}), "sp.js");


After that I can get status, but I need to get status synchronous.








0 commentaires:

Enregistrer un commentaire