WebAdmin: hide certs if they cannot be used

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2024-09-26 17:59:20 +02:00
parent ae5ecbe909
commit 27e98b85ce
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF
2 changed files with 5 additions and 1 deletions

View file

@ -39,6 +39,7 @@ import (
"github.com/drakkan/sftpgo/v2/internal/acme"
"github.com/drakkan/sftpgo/v2/internal/common"
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
"github.com/drakkan/sftpgo/v2/internal/ftpd"
"github.com/drakkan/sftpgo/v2/internal/kms"
"github.com/drakkan/sftpgo/v2/internal/logger"
"github.com/drakkan/sftpgo/v2/internal/mfa"
@ -46,6 +47,7 @@ import (
"github.com/drakkan/sftpgo/v2/internal/smtp"
"github.com/drakkan/sftpgo/v2/internal/util"
"github.com/drakkan/sftpgo/v2/internal/vfs"
"github.com/drakkan/sftpgo/v2/internal/webdavd"
)
type userPageMode int
@ -187,6 +189,7 @@ type userPage struct {
Roles []dataprovider.Role
CanImpersonate bool
FsWrapper fsWrapper
CanUseTLSCerts bool
}
type adminPage struct {
@ -962,6 +965,7 @@ func (s *httpdServer) renderUserPage(w http.ResponseWriter, r *http.Request, use
Groups: groups,
Roles: roles,
CanImpersonate: os.Getuid() == 0,
CanUseTLSCerts: ftpd.GetStatus().IsActive || webdavd.GetStatus().IsActive,
FsWrapper: fsWrapper{
Filesystem: user.FsConfig,
IsUserPage: true,

View file

@ -210,7 +210,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
</div>
</div>
<div class="card mt-10">
<div class="card mt-10 {{if not .CanUseTLSCerts}}d-none{{end}}">
<div class="card-header bg-light">
<h3 data-i18n="user.tls_certs" class="card-title section-title-inner">TLS certificates</h3>
</div>