bugfix: graph/sharedWithMe fix shared.Owner property

The value of driveItem.remoteItem.shared.Owner should match the owner property
of the received share not the owner property of the resourceInfo.
This commit is contained in:
Ralf Haferkamp
2024-01-11 17:47:18 +01:00
committed by Ralf Haferkamp
parent 03e704c291
commit b5af346384

View File

@@ -186,6 +186,22 @@ func (g Graph) listSharedWithMe(ctx context.Context) ([]libregraph.DriveItem, er
}
remoteItem.SetCreatedBy(identitySet)
}
if userID := receivedShare.GetShare().GetOwner(); userID != nil {
user, err := g.identityCache.GetUser(ctx, userID.GetOpaqueId())
if err != nil {
g.logger.Error().Err(err).Msg("could not get user")
return err
}
identitySet := libregraph.IdentitySet{
User: &libregraph.Identity{
DisplayName: user.GetDisplayName(),
Id: libregraph.PtrString(user.GetId()),
},
}
shared.SetOwner(identitySet)
}