@@ -36,15 +36,16 @@ public static class IWorkflowRuntimeContextExtensions
3636 /// <param name="context">The current <see cref="IWorkflowRuntimeContext"/></param>
3737 /// <param name="expressionObject">The object to evaluate</param>
3838 /// <param name="data">The data to evaluate the object against</param>
39+ /// <param name="authorization">The current <see cref="AuthorizationInfo"/>, if any</param>
3940 /// <param name="cancellationToken">A <see cref="CancellationToken"/></param>
4041 /// <returns>The evaluated object</returns>
41- public static async Task < object ? > EvaluateObjectAsync ( this IWorkflowRuntimeContext context , object expressionObject , object data , CancellationToken cancellationToken = default )
42+ public static async Task < object ? > EvaluateObjectAsync ( this IWorkflowRuntimeContext context , object expressionObject , object data , AuthorizationInfo ? authorization , CancellationToken cancellationToken = default )
4243 {
4344 var json = JsonConvert . SerializeObject ( expressionObject , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore } ) ; ;
4445 foreach ( var match in Regex . Matches ( json , @"""\$\{.+?\}""" , RegexOptions . Compiled ) . Cast < Match > ( ) )
4546 {
4647 var expression = Regex . Unescape ( match . Value [ 3 ..^ 2 ] . Trim ( ) . Replace ( @"\""" , @"""" ) ) ;
47- var evaluationResult = await context . EvaluateAsync ( expression , data , cancellationToken ) ;
48+ var evaluationResult = await context . EvaluateAsync ( expression , data , authorization , cancellationToken ) ;
4849 if ( evaluationResult == null ) continue ;
4950 var valueToken = JToken . FromObject ( evaluationResult ) ;
5051 var value = null as string ;
@@ -62,6 +63,19 @@ public static class IWorkflowRuntimeContextExtensions
6263 return JsonConvert . DeserializeObject < ExpandoObject > ( json ) ! ;
6364 }
6465
66+ /// <summary>
67+ /// Evaluates an object against the specified data
68+ /// </summary>
69+ /// <param name="context">The current <see cref="IWorkflowRuntimeContext"/></param>
70+ /// <param name="expressionObject">The object to evaluate</param>
71+ /// <param name="data">The data to evaluate the object against</param>
72+ /// <param name="cancellationToken">A <see cref="CancellationToken"/></param>
73+ /// <returns>The evaluated object</returns>
74+ public static Task < object ? > EvaluateObjectAsync ( this IWorkflowRuntimeContext context , object expressionObject , object data , CancellationToken cancellationToken = default )
75+ {
76+ return EvaluateObjectAsync ( context , expressionObject , data , null , cancellationToken ) ;
77+ }
78+
6579 /// <summary>
6680 /// Evaluates the specified condition expression
6781 /// </summary>
@@ -123,9 +137,7 @@ public static async Task<bool> EvaluateConditionAsync(this IWorkflowRuntimeConte
123137 /// <returns>The filtered output</returns>
124138 public static async Task < object ? > FilterOutputAsync ( this IWorkflowRuntimeContext context , StateDefinition state , object output , CancellationToken cancellationToken = default )
125139 {
126- if ( state . DataFilter == null
127- || string . IsNullOrWhiteSpace ( state . DataFilter . Output ) )
128- return output ;
140+ if ( state . DataFilter == null || string . IsNullOrWhiteSpace ( state . DataFilter . Output ) ) return output ;
129141 return await context . EvaluateAsync ( state . DataFilter . Output , output , cancellationToken ) ;
130142 }
131143
@@ -135,14 +147,28 @@ public static async Task<bool> EvaluateConditionAsync(this IWorkflowRuntimeConte
135147 /// <param name="context">The <see cref="IWorkflowRuntimeContext"/> to use</param>
136148 /// <param name="action">The <see cref="ActionDefinition"/> to filter the output for</param>
137149 /// <param name="output">The output data to filter</param>
150+ /// <param name="authorization">The current <see cref="AuthorizationInfo"/>, if any</param>
138151 /// <param name="cancellationToken">A <see cref="CancellationToken"/></param>
139152 /// <returns>The filtered output</returns>
140- public static async Task < object ? > FilterOutputAsync ( this IWorkflowRuntimeContext context , ActionDefinition action , object output , CancellationToken cancellationToken = default )
153+ public static async Task < object ? > FilterOutputAsync ( this IWorkflowRuntimeContext context , ActionDefinition action , object output , AuthorizationInfo ? authorization , CancellationToken cancellationToken = default )
141154 {
142155 if ( action . ActionDataFilter == null
143156 || string . IsNullOrWhiteSpace ( action . ActionDataFilter . Results ) )
144157 return output ;
145- return await context . EvaluateAsync ( action . ActionDataFilter . Results , output , cancellationToken ) ;
158+ return await context . EvaluateAsync ( action . ActionDataFilter . Results , output , authorization , cancellationToken ) ;
159+ }
160+
161+ /// <summary>
162+ /// Filters the output of the specified <see cref="ActionDefinition"/>
163+ /// </summary>
164+ /// <param name="context">The <see cref="IWorkflowRuntimeContext"/> to use</param>
165+ /// <param name="action">The <see cref="ActionDefinition"/> to filter the output for</param>
166+ /// <param name="output">The output data to filter</param>
167+ /// <param name="cancellationToken">A <see cref="CancellationToken"/></param>
168+ /// <returns>The filtered output</returns>
169+ public static Task < object ? > FilterOutputAsync ( this IWorkflowRuntimeContext context , ActionDefinition action , object output , CancellationToken cancellationToken = default )
170+ {
171+ return FilterOutputAsync ( context , action , output , cancellationToken ) ;
146172 }
147173
148174 /// <summary>
0 commit comments