From c2908e17fac9efe4a7e864c6c0da461aa12f24c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Mon, 6 Dec 2021 19:24:30 +0800 Subject: [PATCH] =?UTF-8?q?SSH=E8=AE=A4=E8=AF=81=E6=94=AF=E6=8C=81sudo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/web/actions/default/clusters/grants/create.go | 2 ++ .../web/actions/default/clusters/grants/createPopup.go | 3 +++ internal/web/actions/default/clusters/grants/update.go | 2 ++ .../web/actions/default/clusters/grants/updatePopup.go | 4 ++++ web/views/@default/clusters/grants/create.html | 7 +++++++ web/views/@default/clusters/grants/createPopup.html | 7 +++++++ web/views/@default/clusters/grants/grant.html | 8 +++++++- web/views/@default/clusters/grants/update.html | 8 +++++++- web/views/@default/clusters/grants/updatePopup.html | 7 +++++++ web/views/@default/dashboard/boards/index.html | 4 ++-- 10 files changed, 48 insertions(+), 4 deletions(-) diff --git a/internal/web/actions/default/clusters/grants/create.go b/internal/web/actions/default/clusters/grants/create.go index ec86f6fb..54d7e29d 100644 --- a/internal/web/actions/default/clusters/grants/create.go +++ b/internal/web/actions/default/clusters/grants/create.go @@ -30,6 +30,7 @@ func (this *CreateAction) RunPost(params struct { PrivateKey string Passphrase string Description string + Su bool Must *actions.Must }) { @@ -61,6 +62,7 @@ func (this *CreateAction) RunPost(params struct { PrivateKey: params.PrivateKey, Passphrase: params.Passphrase, Description: params.Description, + Su: params.Su, NodeId: 0, }) if err != nil { diff --git a/internal/web/actions/default/clusters/grants/createPopup.go b/internal/web/actions/default/clusters/grants/createPopup.go index f65514ff..49d8f171 100644 --- a/internal/web/actions/default/clusters/grants/createPopup.go +++ b/internal/web/actions/default/clusters/grants/createPopup.go @@ -31,6 +31,7 @@ func (this *CreatePopupAction) RunPost(params struct { PrivateKey string Passphrase string Description string + Su bool Must *actions.Must }) { @@ -62,6 +63,7 @@ func (this *CreatePopupAction) RunPost(params struct { PrivateKey: params.PrivateKey, Passphrase: params.Passphrase, Description: params.Description, + Su: params.Su, NodeId: 0, }) if err != nil { @@ -74,6 +76,7 @@ func (this *CreatePopupAction) RunPost(params struct { "name": params.Name, "method": params.Method, "methodName": grantutils.FindGrantMethodName(params.Method), + "username": params.Username, } // 创建日志 diff --git a/internal/web/actions/default/clusters/grants/update.go b/internal/web/actions/default/clusters/grants/update.go index 5b632244..00eb4b4b 100644 --- a/internal/web/actions/default/clusters/grants/update.go +++ b/internal/web/actions/default/clusters/grants/update.go @@ -60,6 +60,7 @@ func (this *UpdateAction) RunPost(params struct { PrivateKey string Passphrase string Description string + Su bool Must *actions.Must }) { @@ -97,6 +98,7 @@ func (this *UpdateAction) RunPost(params struct { PrivateKey: params.PrivateKey, Passphrase: params.Passphrase, Description: params.Description, + Su: params.Su, NodeId: 0, }) if err != nil { diff --git a/internal/web/actions/default/clusters/grants/updatePopup.go b/internal/web/actions/default/clusters/grants/updatePopup.go index 41e402de..184757ae 100644 --- a/internal/web/actions/default/clusters/grants/updatePopup.go +++ b/internal/web/actions/default/clusters/grants/updatePopup.go @@ -44,6 +44,7 @@ func (this *UpdatePopupAction) RunGet(params struct { "description": grant.Description, "privateKey": grant.PrivateKey, "passphrase": grant.Passphrase, + "su": grant.Su, } this.Show() @@ -59,6 +60,7 @@ func (this *UpdatePopupAction) RunPost(params struct { PrivateKey string Passphrase string Description string + Su bool Must *actions.Must }) { @@ -96,6 +98,7 @@ func (this *UpdatePopupAction) RunPost(params struct { Passphrase: params.Passphrase, Description: params.Description, NodeId: params.NodeId, + Su: params.Su, }) if err != nil { this.ErrorPage(err) @@ -108,6 +111,7 @@ func (this *UpdatePopupAction) RunPost(params struct { "name": params.Name, "method": params.Method, "methodName": grantutils.FindGrantMethodName(params.Method), + "username": params.Username, } this.Success() diff --git a/web/views/@default/clusters/grants/create.html b/web/views/@default/clusters/grants/create.html index 46dd33e0..ee60dda6 100644 --- a/web/views/@default/clusters/grants/create.html +++ b/web/views/@default/clusters/grants/create.html @@ -66,6 +66,13 @@ + + 执行sudo + + +

非root的用户可以使用sudo获得更高权限来执行命令。

+ + 备注 diff --git a/web/views/@default/clusters/grants/createPopup.html b/web/views/@default/clusters/grants/createPopup.html index 58561b18..2f32a624 100644 --- a/web/views/@default/clusters/grants/createPopup.html +++ b/web/views/@default/clusters/grants/createPopup.html @@ -65,6 +65,13 @@ + + 执行sudo + + +

非root的用户可以使用sudo获得更高权限来执行命令。

+ + 备注 diff --git a/web/views/@default/clusters/grants/grant.html b/web/views/@default/clusters/grants/grant.html index fc99bb1f..84bd2295 100644 --- a/web/views/@default/clusters/grants/grant.html +++ b/web/views/@default/clusters/grants/grant.html @@ -56,7 +56,13 @@ - + + 执行sudo + + Y + N + + 备注 diff --git a/web/views/@default/clusters/grants/update.html b/web/views/@default/clusters/grants/update.html index cc16c202..c5c88696 100644 --- a/web/views/@default/clusters/grants/update.html +++ b/web/views/@default/clusters/grants/update.html @@ -62,7 +62,13 @@ - + + 执行sudo + + +

非root的用户可以使用sudo获得更高权限来执行命令。

+ + 备注 diff --git a/web/views/@default/clusters/grants/updatePopup.html b/web/views/@default/clusters/grants/updatePopup.html index afd973fc..92e752b9 100644 --- a/web/views/@default/clusters/grants/updatePopup.html +++ b/web/views/@default/clusters/grants/updatePopup.html @@ -67,6 +67,13 @@ + + 执行sudo + + +

非root的用户可以使用sudo获得更高权限来执行命令。

+ + 备注 diff --git a/web/views/@default/dashboard/boards/index.html b/web/views/@default/dashboard/boards/index.html index f307a753..243b7a08 100644 --- a/web/views/@default/dashboard/boards/index.html +++ b/web/views/@default/dashboard/boards/index.html @@ -99,12 +99,12 @@ -
+

本周流量

{{weekTraffic}}{{weekTrafficUnit}}
-
+

昨日流量

{{yesterdayTraffic}}{{yesterdayTrafficUnit}}