Skip to content

Commit

Permalink
Merge pull request #2235 from laozc/scoped-admin
Browse files Browse the repository at this point in the history
🌱 Don't require Validate session privileges to check if user session is active
  • Loading branch information
k8s-ci-robot authored Sep 1, 2023
2 parents 53e5baf + 8458b63 commit c1c6207
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ func GetOrCreate(ctx context.Context, params *Params) (*Session, error) {
if cachedSession, ok := sessionCache.Load(sessionKey); ok {
s := cachedSession.(*Session)

vimSessionActive, err := s.SessionManager.SessionIsActive(ctx)
// Retrieve the current session from Managed Object.
// The userSession is active when the value is not nil.
userSession, err := s.SessionManager.UserSession(ctx)
if err != nil {
logger.Error(err, "unable to check if vim session is active")
}
Expand All @@ -141,7 +143,7 @@ func GetOrCreate(ctx context.Context, params *Params) (*Session, error) {
logger.Error(err, "unable to check if rest session is active")
}

if vimSessionActive && tagManagerSession != nil {
if userSession != nil && tagManagerSession != nil {
logger.V(2).Info("found active cached vSphere client session")
return s, nil
}
Expand Down

0 comments on commit c1c6207

Please sign in to comment.