diff --git a/internal/actions/fields.go b/internal/actions/fields.go index de668b82b7..7d0919497e 100644 --- a/internal/actions/fields.go +++ b/internal/actions/fields.go @@ -62,10 +62,12 @@ func (f *FieldConfig) set(name string, value interface{}) { logging.WithFields("name", name).Error("tried to overwrite field") panic("tried to overwrite field") } - v, ok := value.(func(*FieldConfig) interface{}) - if ok { + switch v := value.(type) { + case func(config *FieldConfig) interface{}: f.fields[name] = v(f) - return + case func(config *FieldConfig) func(call goja.FunctionCall) goja.Value: + f.fields[name] = v(f) + default: + f.fields[name] = value } - f.fields[name] = value } diff --git a/internal/actions/object/user_grant.go b/internal/actions/object/user_grant.go index efa8f9cc66..2cc693c202 100644 --- a/internal/actions/object/user_grant.go +++ b/internal/actions/object/user_grant.go @@ -158,9 +158,9 @@ func UserGrantsToDomain(userID string, actionUserGrants []UserGrant) []*domain.U func mapObjectToGrant(object *goja.Object, grant *UserGrant) { for _, key := range object.Keys() { switch key { - case "projectId": + case "projectId", "projectID": grant.ProjectID = object.Get(key).String() - case "projectGrantId": + case "projectGrantId", "projectGrantID": grant.ProjectGrantID = object.Get(key).String() case "roles": if roles, ok := object.Get(key).Export().([]interface{}); ok {