mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.3 KiB
39 lines
1.3 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschränkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System.Collections.ObjectModel;
|
|
using Squidex.Infrastructure.Collections;
|
|
|
|
namespace Squidex.Domain.Apps.Core.Contents
|
|
{
|
|
[Equals(DoNotAddEqualityOperators = true)]
|
|
public sealed class WorkflowTransition : WorkflowCondition
|
|
{
|
|
public static readonly WorkflowTransition Always = new WorkflowTransition(null, null);
|
|
|
|
public WorkflowTransition(string? expression, ReadOnlyCollection<string>? roles)
|
|
: base(expression, roles)
|
|
{
|
|
}
|
|
|
|
public static WorkflowTransition When(string? expression, params string[]? roles)
|
|
{
|
|
if (roles?.Length > 0)
|
|
{
|
|
return new WorkflowTransition(expression, ReadOnlyCollection.Create(roles));
|
|
}
|
|
else if (!string.IsNullOrWhiteSpace(expression))
|
|
{
|
|
return new WorkflowTransition(expression, null);
|
|
}
|
|
else
|
|
{
|
|
return Always;
|
|
}
|
|
}
|
|
}
|
|
}
|