mirror of https://github.com/Squidex/squidex.git
108 changed files with 178 additions and 631 deletions
@ -1,17 +0,0 @@ |
|||||
// ==========================================================================
|
|
||||
// Squidex Headless CMS
|
|
||||
// ==========================================================================
|
|
||||
// Copyright (c) Squidex UG (haftungsbeschränkt)
|
|
||||
// All rights reserved. Licensed under the MIT license.
|
|
||||
// ==========================================================================
|
|
||||
|
|
||||
namespace Squidex.Domain.Apps.Core.Apps |
|
||||
{ |
|
||||
public enum AppPermission |
|
||||
{ |
|
||||
Owner, |
|
||||
Developer, |
|
||||
Editor, |
|
||||
Reader |
|
||||
} |
|
||||
} |
|
||||
@ -1,39 +0,0 @@ |
|||||
// ==========================================================================
|
|
||||
// Squidex Headless CMS
|
|
||||
// ==========================================================================
|
|
||||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
||||
// All rights reserved. Licensed under the MIT license.
|
|
||||
// ==========================================================================
|
|
||||
|
|
||||
using System.Collections.Generic; |
|
||||
using Squidex.Infrastructure; |
|
||||
using Squidex.Infrastructure.Json.Objects; |
|
||||
|
|
||||
namespace Squidex.Domain.Apps.Core.ExtractReferenceIds |
|
||||
{ |
|
||||
public static class ReferencesExtensions |
|
||||
{ |
|
||||
public static void AddIds(this IJsonValue? value, HashSet<DomainId> result, int take) |
|
||||
{ |
|
||||
var added = 0; |
|
||||
|
|
||||
if (value is JsonArray array) |
|
||||
{ |
|
||||
foreach (var id in array) |
|
||||
{ |
|
||||
if (id is JsonString s) |
|
||||
{ |
|
||||
result.Add(DomainId.Create(s.Value)); |
|
||||
|
|
||||
added++; |
|
||||
|
|
||||
if (added >= take) |
|
||||
{ |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,83 +0,0 @@ |
|||||
// ==========================================================================
|
|
||||
// Squidex Headless CMS
|
|
||||
// ==========================================================================
|
|
||||
// Copyright (c) Squidex UG (haftungsbeschränkt)
|
|
||||
// All rights reserved. Licensed under the MIT license.
|
|
||||
// ==========================================================================
|
|
||||
|
|
||||
using System.Collections.Generic; |
|
||||
using Squidex.Domain.Apps.Core.Schemas; |
|
||||
using Squidex.Domain.Apps.Core.ValidateContent.Validators; |
|
||||
using Squidex.Infrastructure; |
|
||||
|
|
||||
namespace Squidex.Domain.Apps.Core.ValidateContent |
|
||||
{ |
|
||||
internal sealed class FieldBagValidatorsFactory : IFieldVisitor<IEnumerable<IValidator>, None> |
|
||||
{ |
|
||||
private static readonly FieldBagValidatorsFactory Instance = new FieldBagValidatorsFactory(); |
|
||||
|
|
||||
private FieldBagValidatorsFactory() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
public static IEnumerable<IValidator> CreateValidators(IField field) |
|
||||
{ |
|
||||
return field.Accept(Instance, None.Value); |
|
||||
} |
|
||||
|
|
||||
public IEnumerable<IValidator> Visit(IArrayField field, None args) |
|
||||
{ |
|
||||
yield break; |
|
||||
} |
|
||||
|
|
||||
public IEnumerable<IValidator> Visit(IField<AssetsFieldProperties> field, None args) |
|
||||
{ |
|
||||
yield break; |
|
||||
} |
|
||||
|
|
||||
public IEnumerable<IValidator> Visit(IField<BooleanFieldProperties> field, None args) |
|
||||
{ |
|
||||
yield break; |
|
||||
} |
|
||||
|
|
||||
public IEnumerable<IValidator> Visit(IField<DateTimeFieldProperties> field, None args) |
|
||||
{ |
|
||||
yield break; |
|
||||
} |
|
||||
|
|
||||
public IEnumerable<IValidator> Visit(IField<GeolocationFieldProperties> field, None args) |
|
||||
{ |
|
||||
yield break; |
|
||||
} |
|
||||
|
|
||||
public IEnumerable<IValidator> Visit(IField<JsonFieldProperties> field, None args) |
|
||||
{ |
|
||||
yield break; |
|
||||
} |
|
||||
|
|
||||
public IEnumerable<IValidator> Visit(IField<NumberFieldProperties> field, None args) |
|
||||
{ |
|
||||
yield break; |
|
||||
} |
|
||||
|
|
||||
public IEnumerable<IValidator> Visit(IField<ReferencesFieldProperties> field, None args) |
|
||||
{ |
|
||||
yield break; |
|
||||
} |
|
||||
|
|
||||
public IEnumerable<IValidator> Visit(IField<StringFieldProperties> field, None args) |
|
||||
{ |
|
||||
yield break; |
|
||||
} |
|
||||
|
|
||||
public IEnumerable<IValidator> Visit(IField<TagsFieldProperties> field, None args) |
|
||||
{ |
|
||||
yield break; |
|
||||
} |
|
||||
|
|
||||
public IEnumerable<IValidator> Visit(IField<UIFieldProperties> field, None args) |
|
||||
{ |
|
||||
yield return NoValueValidator.Instance; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,18 +0,0 @@ |
|||||
// ==========================================================================
|
|
||||
// Squidex Headless CMS
|
|
||||
// ==========================================================================
|
|
||||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
||||
// All rights reserved. Licensed under the MIT license.
|
|
||||
// ==========================================================================
|
|
||||
|
|
||||
using System.Collections.Generic; |
|
||||
|
|
||||
namespace Squidex.Domain.Apps.Entities.Contents.Text |
|
||||
{ |
|
||||
public sealed class SearchContext |
|
||||
{ |
|
||||
public SearchScope Scope { get; set; } |
|
||||
|
|
||||
public HashSet<string> Languages { get; set; } |
|
||||
} |
|
||||
} |
|
||||
@ -1,16 +0,0 @@ |
|||||
// ==========================================================================
|
|
||||
// Squidex Headless CMS
|
|
||||
// ==========================================================================
|
|
||||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
||||
// All rights reserved. Licensed under the MIT license.
|
|
||||
// ==========================================================================
|
|
||||
|
|
||||
using GeoJSON.Net.Converters; |
|
||||
|
|
||||
namespace Squidex.Domain.Apps.Entities.Contents.Text |
|
||||
{ |
|
||||
public sealed class WriteonlyGeoJsonConverter : GeoJsonConverter |
|
||||
{ |
|
||||
public override bool CanWrite => false; |
|
||||
} |
|
||||
} |
|
||||
@ -1,28 +0,0 @@ |
|||||
// ==========================================================================
|
|
||||
// Squidex Headless CMS
|
|
||||
// ==========================================================================
|
|
||||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
||||
// All rights reserved. Licensed under the MIT license.
|
|
||||
// ==========================================================================
|
|
||||
|
|
||||
using System; |
|
||||
|
|
||||
namespace Squidex.Infrastructure |
|
||||
{ |
|
||||
public sealed class DelegateDisposable : IDisposable |
|
||||
{ |
|
||||
private readonly Action action; |
|
||||
|
|
||||
public DelegateDisposable(Action action) |
|
||||
{ |
|
||||
Guard.NotNull(action, nameof(action)); |
|
||||
|
|
||||
this.action = action; |
|
||||
} |
|
||||
|
|
||||
public void Dispose() |
|
||||
{ |
|
||||
action(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,19 +0,0 @@ |
|||||
// ==========================================================================
|
|
||||
// Squidex Headless CMS
|
|
||||
// ==========================================================================
|
|
||||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
||||
// All rights reserved. Licensed under the MIT license.
|
|
||||
// ==========================================================================
|
|
||||
|
|
||||
using System.Threading.Tasks; |
|
||||
using Orleans; |
|
||||
|
|
||||
namespace Squidex.Infrastructure.Orleans |
|
||||
{ |
|
||||
public interface ILockGrain : IGrainWithStringKey |
|
||||
{ |
|
||||
Task<string?> AcquireLockAsync(string key); |
|
||||
|
|
||||
Task ReleaseLockAsync(string releaseToken); |
|
||||
} |
|
||||
} |
|
||||
@ -1,45 +0,0 @@ |
|||||
// ==========================================================================
|
|
||||
// Squidex Headless CMS
|
|
||||
// ==========================================================================
|
|
||||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
||||
// All rights reserved. Licensed under the MIT license.
|
|
||||
// ==========================================================================
|
|
||||
|
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Threading.Tasks; |
|
||||
|
|
||||
namespace Squidex.Infrastructure.Orleans |
|
||||
{ |
|
||||
public sealed class LockGrain : GrainOfString, ILockGrain |
|
||||
{ |
|
||||
private readonly Dictionary<string, string> locks = new Dictionary<string, string>(); |
|
||||
|
|
||||
public Task<string?> AcquireLockAsync(string key) |
|
||||
{ |
|
||||
string? releaseToken = null; |
|
||||
|
|
||||
if (!locks.ContainsKey(key)) |
|
||||
{ |
|
||||
releaseToken = Guid.NewGuid().ToString(); |
|
||||
|
|
||||
locks.Add(key, releaseToken); |
|
||||
} |
|
||||
|
|
||||
return Task.FromResult(releaseToken); |
|
||||
} |
|
||||
|
|
||||
public Task ReleaseLockAsync(string releaseToken) |
|
||||
{ |
|
||||
var key = locks.FirstOrDefault(x => x.Value == releaseToken).Key; |
|
||||
|
|
||||
if (!string.IsNullOrWhiteSpace(key)) |
|
||||
{ |
|
||||
locks.Remove(key); |
|
||||
} |
|
||||
|
|
||||
return Task.CompletedTask; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,16 +0,0 @@ |
|||||
// ==========================================================================
|
|
||||
// Squidex Headless CMS
|
|
||||
// ==========================================================================
|
|
||||
// Copyright (c) Squidex UG (haftungsbeschränkt)
|
|
||||
// All rights reserved. Licensed under the MIT license.
|
|
||||
// ==========================================================================
|
|
||||
|
|
||||
using System.Collections.Generic; |
|
||||
|
|
||||
namespace Squidex.Infrastructure.Validation |
|
||||
{ |
|
||||
public interface IValidatable |
|
||||
{ |
|
||||
void Validate(IList<ValidationError> errors); |
|
||||
} |
|
||||
} |
|
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue