fix(webconsole): rdp 用户隔离上传文件 (#18920)

This commit is contained in:
屈轩
2023-12-07 15:22:10 +08:00
committed by GitHub
parent 526593a2c6
commit 258dca4f78
2 changed files with 13 additions and 3 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ import (
"net"
)
func NewGuacamoleTunnel(host string, port int, user, password string, id string, w, h, dpi int) (*GuacamoleTunnel, error) {
func NewGuacamoleTunnel(host string, port int, user, password string, id string, w, h, dpi int, uId string) (*GuacamoleTunnel, error) {
opts := NewGuacOptions()
opts.ConnectionId = id
opts.Protocol = "rdp"
@@ -41,7 +41,7 @@ func NewGuacamoleTunnel(host string, port int, user, password string, id string,
"password": password,
"enable-drive": "true",
"drive-name": "Cloudpods",
"drive-path": "/opt/cloudpods",
"drive-path": "/opt/cloudpods/" + uId,
"create-drive-path": "true",
}
conn, err := net.Dial("tcp", "127.0.0.1:4822")
+11 -1
View File
@@ -78,7 +78,17 @@ func (s *RDPServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
defer ws.Close()
tunnel, err := guac.NewGuacamoleTunnel(s.Host, s.Port, s.Username, s.Password, s.ConnectionId, s.Width, s.Height, s.Dpi)
tunnel, err := guac.NewGuacamoleTunnel(
s.Host,
s.Port,
s.Username,
s.Password,
s.ConnectionId,
s.Width,
s.Height,
s.Dpi,
s.Session.GetClientSession().GetUserId(),
)
if err != nil {
log.Errorf("NewGuacamoleTunnel error: %v", err)
return