Skip to content

Commit

Permalink
ADD team source and appID for AppendRuntimeInfoForVirtualResource() m…
Browse files Browse the repository at this point in the history
…ethod.
  • Loading branch information
karminski committed Nov 10, 2023
1 parent 5440969 commit 5acbdfc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/controller/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ func (controller *Controller) RunAction(c *gin.Context) {

// actionID has not been created (like actionID is 0 'ILAfx4p1C7d0'), but we still can run it (onboarding case)
if !model.DoesActionHasBeenCreated(actionID) {
// ok, action was not created, fetch app and build a temporary acion.
// ok, action was not created, fetch app and build a temporary action.
app, errInRetrieveApp := controller.Storage.AppStorage.RetrieveAppByTeamIDAndAppID(teamID, appID)
if errInRetrieveApp != nil {
controller.FeedbackBadRequest(c, ERROR_FLAG_CAN_NOT_GET_APP, "get app failed: "+errInRetrieveApp.Error())
Expand Down Expand Up @@ -393,7 +393,7 @@ func (controller *Controller) RunAction(c *gin.Context) {
}
} else {
// process virtual resource action
action.AppendRuntimeInfoForVirtualResource(userAuthToken)
action.AppendRuntimeInfoForVirtualResource(userAuthToken, teamID)
}

// check action template
Expand Down
2 changes: 1 addition & 1 deletion src/controller/public_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (controller *Controller) RunPublicAction(c *gin.Context) {
}
} else {
// process virtual resource action
action.AppendRuntimeInfoForVirtualResource(userAuthToken)
action.AppendRuntimeInfoForVirtualResource(userAuthToken, teamID)
}

// check action template
Expand Down
6 changes: 4 additions & 2 deletions src/model/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

const (
ACTION_RUNTIME_INFO_FIELD_TEAM_ID = "teamID"
ACTION_RUNTIME_INFO_FIELD_APP_ID = "appID"
ACTION_RUNTIME_INFO_FIELD_RESOURCE_ID = "resourceID"
ACTION_RUNTIME_INFO_FIELD_ACTION_ID = "actionID"
ACTION_RUNTIME_INFO_FIELD_AUTHORIZATION = "authorization"
Expand Down Expand Up @@ -307,9 +308,10 @@ func (action *Action) ExportConfigInMap() map[string]interface{} {
}

// the action runtime does not pass the env info for virtual resource, so add them.
func (action *Action) AppendRuntimeInfoForVirtualResource(authorization string) {
func (action *Action) AppendRuntimeInfoForVirtualResource(authorization string, teamID int) {
template := action.ExportTemplateInMap()
template[ACTION_RUNTIME_INFO_FIELD_TEAM_ID] = action.TeamID
template[ACTION_RUNTIME_INFO_FIELD_TEAM_ID] = teamID // the action.TeamID will invalied when onboarding
template[ACTION_RUNTIME_INFO_FIELD_APP_ID] = action.AppRefID
template[ACTION_RUNTIME_INFO_FIELD_RESOURCE_ID] = action.ResourceRefID
template[ACTION_RUNTIME_INFO_FIELD_ACTION_ID] = action.ID
template[ACTION_RUNTIME_INFO_FIELD_AUTHORIZATION] = authorization
Expand Down

0 comments on commit 5acbdfc

Please sign in to comment.