EventManager: disable commands by default

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2024-11-10 11:52:31 +01:00
parent d0f348a46a
commit f07c9a7e01
4 changed files with 47 additions and 17 deletions

View File

@@ -44,6 +44,11 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
<div class="col-md-9">
<select id="idType" name="type" class="form-select" data-control="i18n-select2" data-hide-search="true">
{{- range .ActionTypes}}
{{- if eq .Value 2}}
{{- if not $.EnabledCommands}}
{{- continue}}
{{- end}}
{{- end}}
<option value="{{.Value}}" {{if eq $.Action.Type .Value }}selected{{end}} data-i18n="{{.Name}}"></option>
{{- end}}
</select>
@@ -400,21 +405,13 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
<div class="form-group row action-type action-cmd mt-10">
<label for="idCmdPath" data-i18n="actions.types.command" class="col-md-3 col-form-label">Command</label>
<div class="col-md-9">
<select id="idCmdPath" name="cmd_path" class="form-select" data-control="i18n-select2" data-hide-search="true">
<select id="idCmdPath" name="cmd_path" class="form-select" data-control="i18n-select2" data-hide-search="false">
{{- range .EnabledCommands}}
<option value="{{.}}" {{if eq $.Action.Options.CmdConfig.Cmd . }}selected{{end}}>{{.}}</option>
{{- end}}
</select>
</div>
</div>
{{- else}}
<div class="form-group row action-type action-cmd mt-10">
<label for="idCmdPath" data-i18n="actions.types.command" class="col-md-3 col-form-label">Command</label>
<div class="col-md-9">
<input id="idCmdPath" type="text" class="form-control" name="cmd_path" value="{{.Action.Options.CmdConfig.Cmd}}" aria-describedby="idCmdPathHelp" />
<div id="idCmdPathHelp" class="form-text" data-i18n="actions.command_help"></div>
</div>
</div>
{{- end}}
<div class="form-group row action-type action-cmd mt-10">