[MRM-1717] open loginbox when url need authz.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1412656 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-11-22 20:27:23 +00:00
parent 0fe1b39cf5
commit a18362e7f4
3 changed files with 12 additions and 1 deletions

View File

@ -158,6 +158,7 @@ public class DefaultUserRepositories
} }
AuthenticationResult authn = new AuthenticationResult( true, principal, null ); AuthenticationResult authn = new AuthenticationResult( true, principal, null );
authn.setUser( user );
return new DefaultSecuritySession( authn, user ); return new DefaultSecuritySession( authn, user );
} }

View File

@ -25,6 +25,8 @@ function(jquery,sammy,utils) {
//$.log("devMode:"+window.archivaDevMode); //$.log("devMode:"+window.archivaDevMode);
// no cache for ajax queries as we get datas from servers so preventing caching !! // no cache for ajax queries as we get datas from servers so preventing caching !!
jQuery.ajaxSetup( { jQuery.ajaxSetup( {
cache: false,//!window.archivaDevMode cache: false,//!window.archivaDevMode
@ -37,6 +39,9 @@ function(jquery,sammy,utils) {
displayErrorMessage($.i18n.prop('authz.karma.needed')); displayErrorMessage($.i18n.prop('authz.karma.needed'));
userLogged(function(user){ userLogged(function(user){
userLoggedCallbackFn(user); userLoggedCallbackFn(user);
},function(){
$.log("not logged");
loginBox();
}); });
}, },
500: function(data){ 500: function(data){

View File

@ -35,7 +35,7 @@ define("redback",["jquery","utils","jquery.validate","jquery.json","knockout",
/** /**
* call successFn on success with passing user object coming from cookie * call successFn on success with passing user object coming from cookie
*/ */
userLogged=function(successFn) { userLogged=function(successFn,notLoggedFn) {
// call restServices/redbackServices/loginService/isLogged to know // call restServices/redbackServices/loginService/isLogged to know
// if a session exists and check the cookie // if a session exists and check the cookie
$.log("userLogged"); $.log("userLogged");
@ -48,6 +48,11 @@ define("redback",["jquery","utils","jquery.validate","jquery.json","knockout",
if (successFn){ if (successFn){
successFn(userLogged ? getUserFromLoginCookie():null); successFn(userLogged ? getUserFromLoginCookie():null);
} }
if(!userLogged){
if(notLoggedFn){
notLoggedFn();
}
}
} }
}); });
} }