Browse Source

Do not change permissions when you import apps.

pull/336/head
Sebastian Stehle 7 years ago
parent
commit
d7895d51dc
  1. 28
      src/Squidex.Domain.Apps.Entities/Backup/RestoreGrain.cs

28
src/Squidex.Domain.Apps.Entities/Backup/RestoreGrain.cs

@ -9,14 +9,11 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using NodaTime; using NodaTime;
using Squidex.Domain.Apps.Core.Apps;
using Squidex.Domain.Apps.Entities.Apps.Commands;
using Squidex.Domain.Apps.Entities.Backup.Helpers; using Squidex.Domain.Apps.Entities.Backup.Helpers;
using Squidex.Domain.Apps.Entities.Backup.State; using Squidex.Domain.Apps.Entities.Backup.State;
using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events;
using Squidex.Domain.Apps.Events.Apps; using Squidex.Domain.Apps.Events.Apps;
using Squidex.Infrastructure; using Squidex.Infrastructure;
using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Log; using Squidex.Infrastructure.Log;
using Squidex.Infrastructure.Orleans; using Squidex.Infrastructure.Orleans;
@ -29,7 +26,6 @@ namespace Squidex.Domain.Apps.Entities.Backup
{ {
private readonly IBackupArchiveLocation backupArchiveLocation; private readonly IBackupArchiveLocation backupArchiveLocation;
private readonly IClock clock; private readonly IClock clock;
private readonly ICommandBus commandBus;
private readonly IEnumerable<BackupHandler> handlers; private readonly IEnumerable<BackupHandler> handlers;
private readonly IEventStore eventStore; private readonly IEventStore eventStore;
private readonly IEventDataFormatter eventDataFormatter; private readonly IEventDataFormatter eventDataFormatter;
@ -47,7 +43,6 @@ namespace Squidex.Domain.Apps.Entities.Backup
public RestoreGrain(IBackupArchiveLocation backupArchiveLocation, public RestoreGrain(IBackupArchiveLocation backupArchiveLocation,
IClock clock, IClock clock,
ICommandBus commandBus,
IEventStore eventStore, IEventStore eventStore,
IEventDataFormatter eventDataFormatter, IEventDataFormatter eventDataFormatter,
IEnumerable<BackupHandler> handlers, IEnumerable<BackupHandler> handlers,
@ -57,7 +52,6 @@ namespace Squidex.Domain.Apps.Entities.Backup
{ {
Guard.NotNull(backupArchiveLocation, nameof(backupArchiveLocation)); Guard.NotNull(backupArchiveLocation, nameof(backupArchiveLocation));
Guard.NotNull(clock, nameof(clock)); Guard.NotNull(clock, nameof(clock));
Guard.NotNull(commandBus, nameof(commandBus));
Guard.NotNull(eventStore, nameof(eventStore)); Guard.NotNull(eventStore, nameof(eventStore));
Guard.NotNull(eventDataFormatter, nameof(eventDataFormatter)); Guard.NotNull(eventDataFormatter, nameof(eventDataFormatter));
Guard.NotNull(handlers, nameof(handlers)); Guard.NotNull(handlers, nameof(handlers));
@ -67,7 +61,6 @@ namespace Squidex.Domain.Apps.Entities.Backup
this.backupArchiveLocation = backupArchiveLocation; this.backupArchiveLocation = backupArchiveLocation;
this.clock = clock; this.clock = clock;
this.commandBus = commandBus;
this.eventStore = eventStore; this.eventStore = eventStore;
this.eventDataFormatter = eventDataFormatter; this.eventDataFormatter = eventDataFormatter;
this.handlers = handlers; this.handlers = handlers;
@ -109,7 +102,7 @@ namespace Squidex.Domain.Apps.Entities.Backup
{ {
Guard.NotNull(url, nameof(url)); Guard.NotNull(url, nameof(url));
if (newAppName != null) if (!string.IsNullOrWhiteSpace(newAppName))
{ {
Guard.ValidSlug(newAppName, nameof(newAppName)); Guard.ValidSlug(newAppName, nameof(newAppName));
} }
@ -189,13 +182,6 @@ namespace Squidex.Domain.Apps.Entities.Backup
} }
} }
using (Profiler.Trace("AssignContributor"))
{
await AssignContributorAsync();
Log("Assigned current user as owner");
}
CurrentJob.Status = JobStatus.Completed; CurrentJob.Status = JobStatus.Completed;
Log("Completed, Yeah!"); Log("Completed, Yeah!");
@ -244,18 +230,6 @@ namespace Squidex.Domain.Apps.Entities.Backup
} }
} }
private async Task AssignContributorAsync()
{
await commandBus.PublishAsync(new AssignContributor
{
Actor = actor,
AppId = CurrentJob.AppId,
ContributorId = actor.Identifier,
FromRestore = true,
Role = Role.Developer
});
}
private async Task CleanupAsync() private async Task CleanupAsync()
{ {
await Safe.DeleteAsync(backupArchiveLocation, CurrentJob.Id, log); await Safe.DeleteAsync(backupArchiveLocation, CurrentJob.Id, log);

Loading…
Cancel
Save