File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,12 @@ import (
5
5
"encoding/json"
6
6
"errors"
7
7
"fmt"
8
- "github.com/KubeOperator/kubepi/internal/api/v1/file"
9
- "github.com/KubeOperator/kubepi/internal/api/v1/mfa"
10
8
"io/ioutil"
11
9
"strings"
12
10
11
+ "github.com/KubeOperator/kubepi/internal/api/v1/file"
12
+ "github.com/KubeOperator/kubepi/internal/api/v1/mfa"
13
+
13
14
"github.com/kataras/iris/v12/middleware/jwt"
14
15
15
16
"github.com/KubeOperator/kubepi/internal/api/v1/chart"
@@ -312,9 +313,14 @@ func roleAccessHandler() iris.Handler {
312
313
//// 通过api resource 过滤出来资源主体,method 过滤操作
313
314
p := ctx .Values ().Get ("profile" )
314
315
u := p .(session.UserProfile )
315
- if ! strings .Contains (ctx .Request ().URL .Path , "/proxy" ) && ! strings .Contains (ctx .Request ().URL .Path , "/ws" ) &&
316
- ! strings .Contains (ctx .Request ().URL .Path , "/webkubectl" ) && ! strings .Contains (ctx .Request ().URL .Path , "/webkubectl" ) &&
317
- ! strings .Contains (ctx .Request ().URL .Path , "/charts" ) && ! strings .Contains (ctx .Request ().URL .Path , "/apps" ) {
316
+ isInWhiteList := false
317
+ for _ , path := range resourceWhiteList {
318
+ if strings .Contains (ctx .Request ().URL .Path , fmt .Sprintf ("/%s" , path )) && path != "sessions" {
319
+ isInWhiteList = true
320
+ break
321
+ }
322
+ }
323
+ if ! isInWhiteList {
318
324
// 放通admin权限
319
325
if u .IsAdministrator {
320
326
ctx .Next ()
You can’t perform that action at this time.
0 commit comments