mirror of https://github.com/harness/drone.git
fix: [code-2114] API redirecting to Login (#2245)
* fix: [code-2114] return Unauthorized for anonymous principal call to user api * fix: [code-2114] API redirecting to Loginunified-ui unstabledemo
parent
0bbcc98b61
commit
3539266fb3
|
@ -45,8 +45,7 @@ func RestrictTo(pType enum.PrincipalType) func(http.Handler) http.Handler {
|
|||
if p.UID == types.AnonymousPrincipalUID {
|
||||
log.Ctx(ctx).Debug().Msgf("Valid principal is required, received an Anonymous.")
|
||||
|
||||
// TODO: revert to Unauthorized once UI is handling it properly.
|
||||
render.NotFound(ctx, w)
|
||||
render.Unauthorized(ctx, w)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,8 @@ export const AppContextProvider: React.FC<{ value: AppProps }> = React.memo(func
|
|||
// Fetch current user when conditions to fetch it matched and
|
||||
// - cache does not exist yet
|
||||
// - or cache is expired
|
||||
if (!lazy && (!currentUser || cacheStrategy.isExpired())) {
|
||||
// - currentSession is not Public
|
||||
if (!lazy && (!currentUser || cacheStrategy.isExpired()) && !initialValue.isCurrentSessionPublic) {
|
||||
fetchCurrentUser()
|
||||
}
|
||||
}, [lazy, fetchCurrentUser, currentUser])
|
||||
|
|
Loading…
Reference in New Issue