mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 23:00:55 +03:00
WebAdmin: hide certs if they cannot be used
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -39,6 +39,7 @@ import (
|
|||||||
"github.com/drakkan/sftpgo/v2/internal/acme"
|
"github.com/drakkan/sftpgo/v2/internal/acme"
|
||||||
"github.com/drakkan/sftpgo/v2/internal/common"
|
"github.com/drakkan/sftpgo/v2/internal/common"
|
||||||
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
"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/kms"
|
||||||
"github.com/drakkan/sftpgo/v2/internal/logger"
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
||||||
"github.com/drakkan/sftpgo/v2/internal/mfa"
|
"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/smtp"
|
||||||
"github.com/drakkan/sftpgo/v2/internal/util"
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
||||||
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
"github.com/drakkan/sftpgo/v2/internal/vfs"
|
||||||
|
"github.com/drakkan/sftpgo/v2/internal/webdavd"
|
||||||
)
|
)
|
||||||
|
|
||||||
type userPageMode int
|
type userPageMode int
|
||||||
@@ -187,6 +189,7 @@ type userPage struct {
|
|||||||
Roles []dataprovider.Role
|
Roles []dataprovider.Role
|
||||||
CanImpersonate bool
|
CanImpersonate bool
|
||||||
FsWrapper fsWrapper
|
FsWrapper fsWrapper
|
||||||
|
CanUseTLSCerts bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type adminPage struct {
|
type adminPage struct {
|
||||||
@@ -962,6 +965,7 @@ func (s *httpdServer) renderUserPage(w http.ResponseWriter, r *http.Request, use
|
|||||||
Groups: groups,
|
Groups: groups,
|
||||||
Roles: roles,
|
Roles: roles,
|
||||||
CanImpersonate: os.Getuid() == 0,
|
CanImpersonate: os.Getuid() == 0,
|
||||||
|
CanUseTLSCerts: ftpd.GetStatus().IsActive || webdavd.GetStatus().IsActive,
|
||||||
FsWrapper: fsWrapper{
|
FsWrapper: fsWrapper{
|
||||||
Filesystem: user.FsConfig,
|
Filesystem: user.FsConfig,
|
||||||
IsUserPage: true,
|
IsUserPage: true,
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card mt-10">
|
<div class="card mt-10 {{if not .CanUseTLSCerts}}d-none{{end}}">
|
||||||
<div class="card-header bg-light">
|
<div class="card-header bg-light">
|
||||||
<h3 data-i18n="user.tls_certs" class="card-title section-title-inner">TLS certificates</h3>
|
<h3 data-i18n="user.tls_certs" class="card-title section-title-inner">TLS certificates</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user