bug fixed
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"strings"
|
||||
"kubesphere.io/kubesphere/pkg/constants"
|
||||
"k8s.io/api/rbac/v1"
|
||||
"k8s.io/kubernetes/pkg/util/slice"
|
||||
)
|
||||
|
||||
func Register(ws *restful.WebService) {
|
||||
@@ -86,7 +87,9 @@ func roleUsersHandler(req *restful.Request, resp *restful.Response) {
|
||||
|
||||
for _, roleBinding := range roleBindings {
|
||||
for _, subject := range roleBinding.Subjects {
|
||||
if subject.Kind == v1.UserKind {
|
||||
if subject.Kind == v1.UserKind &&
|
||||
!strings.HasPrefix(subject.Name, "system") &&
|
||||
!slice.ContainsString(users, subject.Name, nil) {
|
||||
users = append(users, subject.Name)
|
||||
}
|
||||
}
|
||||
@@ -110,7 +113,8 @@ func clusterRoleUsersHandler(req *restful.Request, resp *restful.Response) {
|
||||
|
||||
for _, roleBinding := range roleBindings {
|
||||
for _, subject := range roleBinding.Subjects {
|
||||
if subject.Kind == v1.UserKind && !strings.HasPrefix(subject.Name, "system") {
|
||||
if subject.Kind == v1.UserKind && !strings.HasPrefix(subject.Name, "system") &&
|
||||
!slice.ContainsString(users, subject.Name, nil) {
|
||||
users = append(users, subject.Name)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user