CompositeC1Contrib.Core by burningice

<PackageReference Include="CompositeC1Contrib.Core" Version="0.8.4" />

 ConfirmWorkflowActionToken

using Composite.C1Console.Security; using Composite.C1Console.Workflow; using Composite.Core.Serialization; using CompositeC1Contrib.Workflows; using System; using System.Collections.Generic; using System.Text; namespace CompositeC1Contrib { public class ConfirmWorkflowActionToken { public ConfirmWorkflowActionToken(string confirmMessage, Type type) : this(confirmMessage, type, ResolvePermission(type)) { } public ConfirmWorkflowActionToken(string confirmMessage, Type type, IEnumerable<PermissionType> permmissionType) : this(typeof(ConfirmWorkflow), permmissionType) { StringBuilder stringBuilder = new StringBuilder(); StringConversionServices.SerializeKeyValuePair(stringBuilder, "ConfirmMessage", confirmMessage); StringConversionServices.SerializeKeyValuePair<Type>(stringBuilder, "Type", type); this.set_Payload(stringBuilder.ToString()); } public static ActionToken Deserialize(string serialiedWorkflowActionToken) { return WorkflowActionToken.Deserialize(serialiedWorkflowActionToken); } private static IEnumerable<PermissionType> ResolvePermission(Type type) { ActionToken val = Activator.CreateInstance(type) as ActionToken; if (val == null) throw new ArgumentException("Type was not an actiontoken"); return val.get_PermissionTypes(); } } }