public VetoResult AllowOperation(string name, RavenJObject metadata) { VetoResult veto = VetoResult.Allowed; fileSystem.Storage.Batch(accessor => { if (accessor.IsVersioningActive(name) == false) { veto = VetoResult.Allowed; } else if (accessor.IsVersioningDisabledForImport(metadata)) { veto = VetoResult.Allowed; } else { var file = accessor.ReadFile(name); if (fileSystem.ChangesToRevisionsAllowed() == false && (file?.Metadata ?? metadata).Value <string>(VersioningUtil.RavenFileRevisionStatus) == "Historical") { veto = VetoResult.Deny(file == null ? CreationOfHistoricalRevisionIsNotAllowed : ModificationOfHistoricalRevisionIsNotAllowed); } } }); return(veto); }
public VetoResult AllowOperation(string name, RavenJObject metadata) { VetoResult veto = VetoResult.Allowed; fileSystem.Storage.Batch(accessor => { var file = accessor.ReadFile(name); if (file == null) { return; } if (fileSystem.ChangesToRevisionsAllowed() == false && file.Metadata.Value <string>(VersioningUtil.RavenFileRevisionStatus) == "Historical" && accessor.IsVersioningActive(name)) { veto = VetoResult.Deny("Modifying a historical revision is not allowed"); } }); return(veto); }