Reworked the use of scopes.
Instead of requesting all scopes up front, each sub-section of the backup/restore will request the permissions that are relevant for the operation. The effect is that it is not required to grant all permissions to get a backup running. If permissions are failing, that part of the backup will generate warnings for items that are excluded.
This commit is contained in:
@@ -3,18 +3,18 @@
|
||||
using Duplicati.Library.Common.IO;
|
||||
using System.Text.Json;
|
||||
using File = Google.Apis.Drive.v3.Data.File;
|
||||
using Google.Apis.Drive.v3;
|
||||
|
||||
namespace Duplicati.Proprietary.GoogleWorkspace.SourceItems;
|
||||
|
||||
internal class DriveFileCommentsSourceEntry(SourceProvider provider, string parentPath, File file)
|
||||
internal class DriveFileCommentsSourceEntry(string parentPath, File file, DriveService driveService)
|
||||
: StreamResourceEntryBase(SystemIO.IO_OS.PathCombine(parentPath, "comments.json"), file.CreatedTimeDateTimeOffset.HasValue ? file.CreatedTimeDateTimeOffset.Value.UtcDateTime : DateTime.UnixEpoch, file.ModifiedTimeDateTimeOffset.HasValue ? file.ModifiedTimeDateTimeOffset.Value.UtcDateTime : DateTime.UnixEpoch)
|
||||
{
|
||||
public override long Size => -1;
|
||||
|
||||
public override async Task<Stream> OpenRead(CancellationToken cancellationToken)
|
||||
{
|
||||
var service = provider.ApiHelper.GetDriveService();
|
||||
var request = service.Comments.List(file.Id);
|
||||
var request = driveService.Comments.List(file.Id);
|
||||
request.Fields = "*";
|
||||
var comments = await request.ExecuteAsync(cancellationToken);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user