2022-07-17 18:16:00 +00:00
<!--
2024-01-14 08:09:42 +00:00
Copyright (C) 2024 Nicola Murino
2022-07-17 18:16:00 +00:00
2024-01-14 08:09:42 +00:00
This WebUI uses the KeenThemes Mega Bundle, a proprietary theme:
2022-07-17 18:16:00 +00:00
2024-01-14 08:09:42 +00:00
https://keenthemes.com/products/templates-mega-bundle
2022-07-17 18:16:00 +00:00
2024-01-14 08:09:42 +00:00
KeenThemes HTML/CSS/JS components are allowed for use only within the
SFTPGo product and restricted to be used in a resealable HTML template
that can compete with KeenThemes products anyhow.
This WebUI is allowed for use only within the SFTPGo product and
therefore cannot be used in derivative works/products without an
explicit grant from the SFTPGo Team (support@sftpgo.com).
2022-07-17 18:16:00 +00:00
-->
2022-04-25 13:49:11 +00:00
{{template "base" .}}
2024-01-14 08:09:42 +00:00
{{- define "page_body"}}
< div class = "card shadow-sm" >
< div class = "card-header bg-light" >
< h3 data-i18n = "{{.Title}}" class = "card-title section-title" > < / h3 >
2022-04-25 13:49:11 +00:00
< / div >
< div class = "card-body" >
2024-01-14 08:09:42 +00:00
{{- template "errmsg" .Error}}
2022-04-25 13:49:11 +00:00
< form id = "group_form" enctype = "multipart/form-data" action = "{{.CurrentURL}}" method = "POST" autocomplete = "off" >
2024-01-14 08:09:42 +00:00
2022-04-25 13:49:11 +00:00
< div class = "form-group row" >
2024-01-14 08:09:42 +00:00
< label for = "idGroupName" data-i18n = "general.name" class = "col-md-3 col-form-label" > Name< / label >
< div class = "col-md-9" >
< input id = "idGroupName" type = "text" class = "form-control" placeholder = "" name = "name" value = "{{.Group.Name}}"
2024-01-21 16:39:08 +00:00
maxlength="255" autocomplete="off" spellcheck="false" required {{if eq .Mode 2}}readonly{{end}} />
2022-04-25 13:49:11 +00:00
< / div >
< / div >
2024-01-14 08:09:42 +00:00
< div class = "form-group row mt-10" >
< label for = "idDescription" data-i18n = "general.description" class = "col-md-3 col-form-label" > Description< / label >
< div class = "col-md-9" >
< input id = "idDescription" type = "text" class = "form-control" name = "description" value = "{{.Group.Description}}" maxlength = "255" >
2022-04-25 13:49:11 +00:00
< / div >
< / div >
2024-01-14 08:09:42 +00:00
{{- template "fshtml" .FsWrapper}}
{{- if .VirtualFolders}}
< div class = "card mt-10 {{if .LoggedUser.Filters.Preferences.HideVirtualFolders}}d-none{{end}}" >
< div class = "card-header bg-light" >
< h3 data-i18n = "title.folders" class = "card-title section-title-inner" > Virtual folders< / h3 >
2022-04-25 13:49:11 +00:00
< / div >
< div class = "card-body" >
2024-01-14 08:09:42 +00:00
< div id = "virtual_folders" >
< p class = "fs-5 fw-semibold mb-4" data-i18n = "user.virtual_folders_help" >
Quota size/files -1 means included within user quota, 0 unlimited. Don't set -1 for shared folders. You can use MB/GB/TB suffix. Without suffix we assume bytes
< / p >
< div class = "form-group" >
< div data-repeater-list = "virtual_folders" >
{{- range $idx, $val := .Group.VirtualFolders}}
< div data-repeater-item >
< div data-repeater-item >
< div class = "form-group row" >
< div class = "col-md-3 mt-3 mt-md-8" >
< input data-i18n = "[placeholder]virtual_folders.mount_path" type = "text" class = "form-control" name = "vfolder_path" value = "{{$val.VirtualPath}}" / >
2022-04-25 13:49:11 +00:00
< / div >
2024-01-14 08:09:42 +00:00
< div class = "col-md-3 mt-3 mt-md-8" >
< select name = "vfolder_name" data-i18n = "[data-placeholder]general.folder_placeholder" class = "form-select select-repetear" data-placeholder = "Select a folder" data-allow-clear = "true" >
< option value = "" > < / option >
{{- range $.VirtualFolders}}
< option value = "{{.Name}}" { { - if eq $ val . Name . Name } } selected { { - end } } > {{.Name}}< / option >
{{- end}}
< / select >
< / div >
< div class = "col-md-3 mt-3 mt-md-8" >
< input type = "text" class = "form-control" name = "vfolder_quota_size" value = "{{HumanizeBytes $val.QuotaSize}}" / >
< div class = "form-text" data-i18n = "virtual_folders.quota_size" > < / div >
< / div >
< div class = "col-md-2 mt-3 mt-md-8" >
< input type = "number" min = "-1" class = "form-control" name = "vfolder_quota_files" value = "{{$val.QuotaFiles}}" / >
< div class = "form-text" data-i18n = "virtual_folders.quota_files" > < / div >
< / div >
< div class = "col-md-1 mt-3 mt-md-8" >
< a href = "#" data-repeater-delete
class="btn btn-light-danger ps-5 pe-4">
< i class = "ki-duotone ki-trash fs-2" >
< span class = "path1" > < / span >
< span class = "path2" > < / span >
< span class = "path3" > < / span >
< span class = "path4" > < / span >
< span class = "path5" > < / span >
< / i >
< / a >
2022-04-25 13:49:11 +00:00
< / div >
< / div >
< / div >
< / div >
2024-01-14 08:09:42 +00:00
{{- else}}
< div data-repeater-item >
2022-04-25 13:49:11 +00:00
< div class = "form-group row" >
2024-01-14 08:09:42 +00:00
< div class = "col-md-3 mt-3 mt-md-8" >
< input data-i18n = "[placeholder]virtual_folders.mount_path" type = "text" class = "form-control" name = "vfolder_path" value = "" / >
< / div >
< div class = "col-md-3 mt-3 mt-md-8" >
< select name = "vfolder_name" data-i18n = "[data-placeholder]general.folder_placeholder" class = "form-select select-repetear" data-placeholder = "Select a folder" data-allow-clear = "true" >
< option value = "" > < / option >
{{- range .VirtualFolders}}
< option value = "{{.Name}}" > {{.Name}}< / option >
{{- end}}
< / select >
< / div >
< div class = "col-md-3 mt-3 mt-md-8" >
< input type = "text" class = "form-control" name = "vfolder_quota_size" value = "" / >
< div class = "form-text" data-i18n = "virtual_folders.quota_size" > < / div >
< / div >
< div class = "col-md-2 mt-3 mt-md-8" >
< input type = "number" min = "-1" class = "form-control" name = "vfolder_quota_files" value = "" / >
< div class = "form-text" data-i18n = "virtual_folders.quota_files" > < / div >
< / div >
< div class = "col-md-1 mt-3 mt-md-8" >
< a href = "#" data-repeater-delete
class="btn btn-light-danger ps-5 pe-4">
< i class = "ki-duotone ki-trash fs-2" >
< span class = "path1" > < / span >
< span class = "path2" > < / span >
< span class = "path3" > < / span >
< span class = "path4" > < / span >
< span class = "path5" > < / span >
< / i >
< / a >
2022-04-25 13:49:11 +00:00
< / div >
< / div >
< / div >
2024-01-14 08:09:42 +00:00
{{- end}}
2022-04-25 13:49:11 +00:00
< / div >
2024-01-14 08:09:42 +00:00
< / div >
2022-04-25 13:49:11 +00:00
2024-01-14 08:09:42 +00:00
< div class = "form-group mt-5" >
< a href = "#" data-repeater-create class = "btn btn-light-primary" >
< i class = "ki-duotone ki-plus fs-3" > < / i >
< span data-i18n = "general.add" > Add< / span >
< / a >
2022-04-25 13:49:11 +00:00
< / div >
< / div >
< / div >
2024-01-14 08:09:42 +00:00
< / div >
{{- end}}
2022-04-25 13:49:11 +00:00
2024-01-14 08:09:42 +00:00
< div class = "accordion shadow-sm mt-10" id = "accordionUser" >
2022-04-25 13:49:11 +00:00
2024-01-14 08:09:42 +00:00
< div class = "accordion-item" >
< h2 class = "accordion-header" id = "headingPermissions" >
< button class = "accordion-button section-title-inner text-primary collapsed" type = "button" data-bs-toggle = "collapse" data-bs-target = "#collapsePermissions" aria-expanded = "true" aria-controls = "collapsePermissions" >
< span data-i18n = "general.acls" > ACLs< / span >
< / button >
< / h2 >
< div id = "collapsePermissions" class = "accordion-collapse collapse" aria-labelledby = "headingPermissions" data-bs-parent = "#accordionUser" >
< div class = "accordion-body" >
2022-04-25 13:49:11 +00:00
2024-01-14 08:09:42 +00:00
< div class = "card mt-10" >
< div class = "card-header bg-light" >
< h3 data-i18n = "filters.directory_permissions" class = "card-title section-title-inner" > Per-directory permissions< / h3 >
2022-04-25 13:49:11 +00:00
< / div >
< div class = "card-body" >
2024-01-14 08:09:42 +00:00
< div id = "directory_permissions" >
< p class = "fs-5 fw-semibold mb-4" data-i18n = "filters.directory_permissions_help" > < / p >
< div class = "form-group" >
< div data-repeater-list = "directory_permissions" >
{{- range $idx, $dirPerms := .Group.GetPermissions -}}
< div data-repeater-item >
< div class = "form-group row" >
< div class = "col-md-6 mt-3 mt-md-8" >
< input data-i18n = "[placeholder]filters.directory_path_help" type = "text" class = "form-control" name = "sub_perm_path" value = "{{$dirPerms.Path}}" / >
< / div >
< div class = "col-md-5 mt-3 mt-md-8" >
< select name = "sub_perm_permissions" data-i18n = "[data-placeholder]general.permissions" class = "form-select select-repetear" data-hide-search = "true" data-close-on-select = "false" multiple >
{{- range $validPerm := $.ValidPerms}}
< option value = "{{$validPerm}}" { { - range $ perm : = $dirPerms.Permissions } } { { - if eq $ perm $ validPerm } } selected { { - end } } { { - end } } > {{$validPerm}}< / option >
{{- end}}
< / select >
< / div >
< div class = "col-md-1 mt-3 mt-md-8" >
< a href = "#" data-repeater-delete
class="btn btn-light-danger ps-5 pe-4">
< i class = "ki-duotone ki-trash fs-2" >
< span class = "path1" > < / span >
< span class = "path2" > < / span >
< span class = "path3" > < / span >
< span class = "path4" > < / span >
< span class = "path5" > < / span >
< / i >
< / a >
< / div >
2022-04-25 13:49:11 +00:00
< / div >
< / div >
2024-01-14 08:09:42 +00:00
{{- else}}
< div data-repeater-item >
< div class = "form-group row" >
< div class = "col-md-6 mt-3 mt-md-8" >
< input data-i18n = "[placeholder]filters.directory_path_help" type = "text" class = "form-control" name = "sub_perm_path" value = "" / >
< / div >
< div class = "col-md-5 mt-3 mt-md-8" >
< select name = "sub_perm_permissions" data-i18n = "[data-placeholder]general.permissions" class = "form-select select-repetear" data-hide-search = "true" data-close-on-select = "false" multiple >
{{- range $validPerm := .ValidPerms}}
< option value = "{{$validPerm}}" > {{$validPerm}}< / option >
{{- end}}
< / select >
< / div >
< div class = "col-md-1 mt-3 mt-md-8" >
< a href = "#" data-repeater-delete
class="btn btn-light-danger ps-5 pe-4">
< i class = "ki-duotone ki-trash fs-2" >
< span class = "path1" > < / span >
< span class = "path2" > < / span >
< span class = "path3" > < / span >
< span class = "path4" > < / span >
< span class = "path5" > < / span >
< / i >
< / a >
< / div >
2022-04-25 13:49:11 +00:00
< / div >
< / div >
2024-01-14 08:09:42 +00:00
{{- end}}
2022-04-25 13:49:11 +00:00
< / div >
< / div >
2024-01-14 08:09:42 +00:00
< div class = "form-group mt-5" >
< a href = "#" data-repeater-create class = "btn btn-light-primary" >
< i class = "ki-duotone ki-plus fs-3" > < / i >
< span data-i18n = "general.add" > Add< / span >
< / a >
< / div >
2022-04-25 13:49:11 +00:00
< / div >
< / div >
< / div >
2024-01-14 08:09:42 +00:00
{{- template "user_group_perms" .Group.UserSettings.Filters}}
2022-04-25 13:49:11 +00:00
2024-01-14 08:09:42 +00:00
< div class = "form-group row mt-10" >
< label for = "idMaxSessions" data-i18n = "filters.max_sessions" class = "col-md-3 col-form-label" > Max sessions< / label >
< div class = "col-md-9" >
< input id = "idMaxSessions" type = "number" min = "0" class = "form-control" name = "max_sessions" value = "{{.Group.UserSettings.MaxSessions}}" aria-describedby = "idMaxSessionsHelp" / >
< div id = "idMaxSessionsHelp" class = "form-text" data-i18n = "filters.max_sessions_help" > < / div >
2022-04-25 13:49:11 +00:00
< / div >
< / div >
2024-01-14 08:09:42 +00:00
< div class = "form-group row mt-10" >
< label for = "idProtocols" data-i18n = "filters.denied_protocols" class = "col-md-3 col-form-label" >
Denied protocols
< / label >
< div class = "col-md-9" >
< select id = "idProtocols" name = "denied_protocols" class = "form-select" data-control = "i18n-select2" data-close-on-select = "false" multiple >
{{- range $protocol := .ValidProtocols}}
< option value = "{{$protocol}}" { { - range $ p : = $.Group.UserSettings.Filters.DeniedProtocols } } { { - if eq $ p $ protocol } } selected { { - end } } { { - end } } > {{$protocol}}< / option >
{{- end}}
< / select >
2022-04-25 13:49:11 +00:00
< / div >
< / div >
2024-01-14 08:09:42 +00:00
< div class = "form-group row mt-10" >
< label for = "idLoginMethods" data-i18n = "filters.denied_login_methods" class = "col-md-3 col-form-label" >
Denied login methods
< / label >
< div class = "col-md-9" >
< select id = "idLoginMethods" name = "denied_login_methods" class = "form-select" data-control = "i18n-select2" data-close-on-select = "false" multiple aria-describedby = "idLoginMethodsHelp" >
{{- range $method := .ValidLoginMethods}}
< option value = "{{$method}}" { { - range $ m : = $.Group.UserSettings.Filters.DeniedLoginMethods } } { { - if eq $ m $ method } } selected { { - end } } { { - end } } > {{$method}}< / option >
{{- end}}
2022-04-25 13:49:11 +00:00
< / select >
2024-01-14 08:09:42 +00:00
< div id = "idLoginMethodsHelp" data-i18n = "filters.denied_login_methods_help" class = "form-text" >
< / div >
2022-04-25 13:49:11 +00:00
< / div >
< / div >
2024-01-14 08:09:42 +00:00
< div class = "form-group row mt-10" >
< label for = "idTwoFactorProtocols" data-i18n = "2fa.require_for" class = "col-md-3 col-form-label" >
Require 2FA for
< / label >
< div class = "col-md-9" >
< select id = "idTwoFactorProtocols" name = "required_two_factor_protocols" class = "form-select" data-control = "i18n-select2" data-close-on-select = "false" multiple >
{{- range $protocol := .TwoFactorProtocols}}
< option value = "{{$protocol}}" { { - range $ p : = $.Group.UserSettings.Filters.TwoFactorAuthProtocols } } { { - if eq $ p $ protocol } } selected { { - end } } { { - end } } > {{$protocol}}< / option >
{{end}}
2022-07-26 16:51:39 +00:00
< / select >
< / div >
< / div >
2024-01-14 08:09:42 +00:00
< div class = "form-group row mt-10" >
< label for = "idWebClient" data-i18n = "filters.web_client_options" class = "col-md-3 col-form-label" >
Web client/REST API
< / label >
< div class = "col-md-9" >
< select id = "idWebClient" name = "web_client_options" class = "form-select" data-control = "i18n-select2" data-close-on-select = "false" multiple >
{{- range $option := .WebClientOptions}}
< option value = "{{$option}}" { { - range $ p : = $.Group.UserSettings.Filters.WebClient } } { { - if eq $ p $ option } } selected { { - end } } { { - end } } > {{$option}}< / option >
{{- end}}
< / select >
2023-02-13 18:32:36 +00:00
< / div >
< / div >
2024-01-14 08:09:42 +00:00
< div class = "form-group row mt-10" >
< label for = "idDeniedIP" data-i18n = "general.denied_ip_mask" class = "col-md-3 col-form-label" > Denied IP/Mask< / label >
< div class = "col-md-9" >
< textarea class = "form-control" id = "idDeniedIP" name = "denied_ip" aria-describedby = "idDeniedIPHelp"
rows="3">{{.Group.GetDeniedIPAsString}}< / textarea >
< div id = "idDeniedIPHelp" class = "form-text" data-i18n = "general.ip_mask_help" > < / div >
2023-03-02 08:11:30 +00:00
< / div >
< / div >
2024-01-14 08:09:42 +00:00
< div class = "form-group row mt-10" >
< label for = "idAllowedIP" data-i18n = "general.allowed_ip_mask" class = "col-md-3 col-form-label" > Allowed IP/Mask< / label >
< div class = "col-md-9" >
< textarea class = "form-control" id = "idAllowedIP" name = "allowed_ip" aria-describedby = "idAllowedIPHelp"
rows="3">{{.Group.GetAllowedIPAsString}}< / textarea >
< div id = "idAllowedIPHelp" class = "form-text" data-i18n = "general.ip_mask_help" > < / div >
2022-12-11 16:15:34 +00:00
< / div >
< / div >
2024-01-14 08:09:42 +00:00
< / div >
< / div >
2022-08-28 12:41:42 +00:00
2024-01-14 08:09:42 +00:00
< / div >
2023-08-07 17:07:20 +00:00
2024-01-14 08:09:42 +00:00
< div class = "accordion-item" >
< h2 class = "accordion-header" id = "headingQuota" >
< button class = "accordion-button section-title-inner text-primary collapsed" type = "button" data-bs-toggle = "collapse" data-bs-target = "#collapseQuota" aria-expanded = "true" aria-controls = "collapseQuota" >
< span data-i18n = "general.quota_limits" > Disk quota and bandwidth limits< / span >
< / button >
< / h2 >
< div id = "collapseQuota" class = "accordion-collapse collapse" aria-labelledby = "headingQuota" data-bs-parent = "#accordionUser" >
< div class = "accordion-body" >
{{- template "user_group_quota" .Group.UserSettings}}
< / div >
< / div >
< / div >
2022-04-25 13:49:11 +00:00
2024-01-14 08:09:42 +00:00
< div class = "accordion-item" >
< h2 class = "accordion-header" id = "headingAdvanced" >
< button class = "accordion-button section-title-inner text-primary collapsed" type = "button" data-bs-toggle = "collapse" data-bs-target = "#collapseAdvanced" aria-expanded = "true" aria-controls = "collapseAdvanced" >
< span data-i18n = "general.advanced_settings" > Advanced settings< / span >
< / button >
< / h2 >
< div id = "collapseAdvanced" class = "accordion-collapse collapse" aria-labelledby = "headingAdvanced" data-bs-parent = "#accordionUser" >
< div class = "accordion-body" >
2022-07-27 16:54:25 +00:00
2024-01-14 08:09:42 +00:00
< div class = "form-group row mt-10" >
< label for = "idExpiresIn" data-i18n = "user.expires_in" class = "col-md-3 col-form-label" > Expires in< / label >
< div class = "col-md-9" >
< input id = "idExpiresIn" type = "number" min = "0" class = "form-control" name = "expires_in" value = "{{.Group.UserSettings.ExpiresIn}}" aria-describedby = "idExpiresIn" / >
< div id = "idExpiresInHelp" class = "form-text" data-i18n = "user.expires_in_help" > < / div >
2022-04-25 13:49:11 +00:00
< / div >
< / div >
2024-01-14 08:09:42 +00:00
{{- template "user_group_profile" .Group.UserSettings.Filters}}
{{- template "user_group_advanced" .Group.UserSettings.Filters}}
2022-04-25 13:49:11 +00:00
2024-01-14 08:09:42 +00:00
< div class = "form-group row mt-10 {{if not .Group.HasExternalAuth}}d-none{{end}}" >
< label for = "idExtAuthCacheTime" data-i18n = "filters.external_auth_cache_time" class = "col-md-3 col-form-label" > External auth cache time< / label >
< div class = "col-md-9" >
< input id = "idExtAuthCacheTime" type = "number" min = "0" class = "form-control" name = "external_auth_cache_time" value = "{{.Group.UserSettings.Filters.ExternalAuthCacheTime}}" aria-describedby = "idExtAuthCacheTimeHelp" / >
< div id = "idExtAuthCacheTimeHelp" class = "form-text" data-i18n = "filters.external_auth_cache_time_help" > < / div >
2022-04-25 13:49:11 +00:00
< / div >
< / div >
< / div >
< / div >
< / div >
2024-01-14 08:09:42 +00:00
2022-04-25 13:49:11 +00:00
< / div >
2024-01-14 08:09:42 +00:00
< div class = "d-flex justify-content-end mt-12" >
< input type = "hidden" name = "_form_token" value = "{{.CSRFToken}}" >
< button type = "submit" id = "form_submit" class = "btn btn-primary px-10" name = "form_action" value = "submit" >
< span data-i18n = "general.submit" class = "indicator-label" >
Submit
< / span >
< span data-i18n = "general.wait" class = "indicator-progress" >
Please wait...
< span class = "spinner-border spinner-border-sm align-middle ms-2" > < / span >
< / span >
< / button >
2022-04-25 13:49:11 +00:00
< / div >
< / form >
< / div >
< / div >
2024-01-14 08:09:42 +00:00
{{- end}}
{{- define "extra_js"}}
< script { { - if . CSPNonce } } nonce = "{{.CSPNonce}}" { { - end } } src = "{{.StaticURL}}/assets/plugins/custom/formrepeater/formrepeater.bundle.js" > < / script >
< script type = "text/javascript" { { - if . CSPNonce } } nonce = "{{.CSPNonce}}" { { - end } } >
function onFilesystemChanged(val){
$('.form-group.fsconfig').hide();
$('.form-group.fsconfig-'+val).show();
}
$(document).on("i18nload", function(){
initRepeater('#virtual_folders');
initRepeater('#directory_permissions');
initRepeater('#directory_patterns');
initRepeater('#src_bandwidth_limits');
initRepeaterItems();
//{{- if .Error}}
$('#accordionUser .collapse').removeAttr("data-bs-parent").collapse('show');
//{{- end}}
2022-04-25 13:49:11 +00:00
onFilesystemChanged('{{.Group.UserSettings.FsConfig.Provider.Name}}');
2024-01-14 08:09:42 +00:00
$('#idFilesystem').on("change", function(){
onFilesystemChanged(this.value);
});
2022-04-25 13:49:11 +00:00
});
2024-01-14 08:09:42 +00:00
$(document).on("i18nshow", function(){
$('#group_form').submit(function (event) {
let submitButton = document.querySelector('#form_submit');
submitButton.setAttribute('data-kt-indicator', 'on');
submitButton.disabled = true;
});
});
< / script >
{{- end}}