@@ -80,7 +80,7 @@ public async Task<ActionResult<UserActionResponse>> Perform(
8080 )
8181 {
8282 string ? action = actionRequest . Action ;
83- if ( action == null )
83+ if ( action is null )
8484 {
8585 return new BadRequestObjectResult (
8686 new ProblemDetails ( )
@@ -94,7 +94,7 @@ public async Task<ActionResult<UserActionResponse>> Perform(
9494 }
9595
9696 Instance instance = await _instanceClient . GetInstance ( app , org , instanceOwnerPartyId , instanceGuid ) ;
97- if ( instance ? . Process == null )
97+ if ( instance ? . Process is null )
9898 {
9999 return Conflict ( $ "Process is not started.") ;
100100 }
@@ -105,8 +105,16 @@ public async Task<ActionResult<UserActionResponse>> Perform(
105105 }
106106
107107 var currentAuth = _authenticationContext . Current ;
108- if ( currentAuth is not Authenticated . User user )
109- return Unauthorized ( ) ;
108+
109+ switch ( currentAuth )
110+ {
111+ case Authenticated . User :
112+ case Authenticated . SystemUser :
113+ case Authenticated . SelfIdentifiedUser :
114+ break ;
115+ default :
116+ return Unauthorized ( ) ;
117+ }
110118
111119 bool authorized = await _authorization . AuthorizeAction (
112120 new AppIdentifier ( org , app ) ,
@@ -124,14 +132,14 @@ public async Task<ActionResult<UserActionResponse>> Perform(
124132
125133 UserActionContext userActionContext = new (
126134 dataMutator ,
127- user . UserId ,
135+ null , // let userId be derived from currentAuth
128136 actionRequest . ButtonId ,
129137 actionRequest . Metadata ,
130138 language ,
131139 currentAuth
132140 ) ;
133141 IUserAction ? actionHandler = _userActionService . GetActionHandler ( action ) ;
134- if ( actionHandler == null )
142+ if ( actionHandler is null )
135143 {
136144 return new NotFoundObjectResult (
137145 new UserActionResponse ( )
@@ -148,7 +156,7 @@ public async Task<ActionResult<UserActionResponse>> Perform(
148156
149157 UserActionResult result = await actionHandler . HandleAction ( userActionContext ) ;
150158
151- if ( result . ResultType == ResultType . Failure )
159+ if ( result . ResultType is ResultType . Failure )
152160 {
153161 return StatusCode (
154162 statusCode : result . ErrorType switch
0 commit comments