Do not error on expired existing child session when assuming
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -536,11 +536,9 @@ func (s SessionService) AssumeOrganizationSession(
|
|||||||
|
|
||||||
// If child session already exists use it
|
// If child session already exists use it
|
||||||
if err := childSession.LoadByRootSessionIDAndMembershipID(ctx, tx, rootSession.IdentityID, membership.ID); err == nil {
|
if err := childSession.LoadByRootSessionIDAndMembershipID(ctx, tx, rootSession.IdentityID, membership.ID); err == nil {
|
||||||
if childSession.ExpireReason != nil || now.After(childSession.ExpiredAt) {
|
if childSession.ExpireReason == nil && now.Before(childSession.ExpiredAt) {
|
||||||
return NewSessionExpiredError(childSession.ID)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if err != coredata.ErrResourceNotFound {
|
if err != coredata.ErrResourceNotFound {
|
||||||
return fmt.Errorf("cannot load child session: %w", err)
|
return fmt.Errorf("cannot load child session: %w", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user