Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
水淹萌龙
kubesphere
提交
bf878945
K
kubesphere
项目概览
水淹萌龙
/
kubesphere
与 Fork 源项目一致
Fork自
KubeSphere / kubesphere
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kubesphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
bf878945
编写于
7月 25, 2020
作者:
W
wanjunlei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
resolve conversation
Signed-off-by:
N
wanjunlei
<
wanjunlei@yunify.com
>
上级
6585881d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
12 deletion
+12
-12
pkg/models/tenant/tenant.go
pkg/models/tenant/tenant.go
+12
-12
未找到文件。
pkg/models/tenant/tenant.go
浏览文件 @
bf878945
...
...
@@ -557,13 +557,13 @@ func (t *tenantOperator) DeleteWorkspace(workspace string) error {
return
t
.
ksclient
.
TenantV1alpha2
()
.
WorkspaceTemplates
()
.
Delete
(
workspace
,
metav1
.
NewDeleteOptions
(
0
))
}
// listIntersectedNamespaces
lists the namespaces which meet all the following conditions at the same time
// 1.
the namespace in workspace which is in workspaces when workspaces is not empty
.
// 2.
the namespace in workspace which contains one of workspaceSubstrs when workspaceSubstrs is not empty
.
// 3.
the namespace which is in namespaces when namespaces is not empty
.
// 4.
the namespace which contains one of namespaceSubstrs when namespaceSubstrs is not empty
.
func
(
t
*
tenantOperator
)
listIntersectedNamespaces
(
user
user
.
Info
,
workspaces
,
workspaceSubstrs
,
namespaces
,
namespaceSubstrs
[]
string
)
([]
*
corev1
.
Namespace
,
error
)
{
// listIntersectedNamespaces
returns a list of namespaces that MUST meet ALL the following filters:
// 1.
If `workspaces` is not empty, the namespace SHOULD belong to one of the specified workpsaces
.
// 2.
If `workspaceSubstrs` is not empty, the namespace SHOULD belong to a workspace whose name contains one of the specified substrings
.
// 3.
If `namespaces` is not empty, the namespace SHOULD be one of the specified namespacs
.
// 4.
If `namespaceSubstrs` is not empty, the namespace's name SHOULD contain one of the specified substrings
.
func
(
t
*
tenantOperator
)
listIntersectedNamespaces
(
workspaces
,
workspaceSubstrs
,
namespaces
,
namespaceSubstrs
[]
string
)
([]
*
corev1
.
Namespace
,
error
)
{
var
(
namespaceSet
=
stringSet
(
namespaces
)
workspaceSet
=
stringSet
(
workspaces
)
...
...
@@ -608,7 +608,7 @@ func (t *tenantOperator) listIntersectedNamespaces(user user.Info,
}
func
(
t
*
tenantOperator
)
Events
(
user
user
.
Info
,
queryParam
*
eventsv1alpha1
.
Query
)
(
*
eventsv1alpha1
.
APIResponse
,
error
)
{
iNamespaces
,
err
:=
t
.
listIntersectedNamespaces
(
user
,
iNamespaces
,
err
:=
t
.
listIntersectedNamespaces
(
stringutils
.
Split
(
queryParam
.
WorkspaceFilter
,
","
),
stringutils
.
Split
(
queryParam
.
WorkspaceSearch
,
","
),
stringutils
.
Split
(
queryParam
.
InvolvedObjectNamespaceFilter
,
","
),
...
...
@@ -669,7 +669,7 @@ func (t *tenantOperator) Events(user user.Info, queryParam *eventsv1alpha1.Query
}
func
(
t
*
tenantOperator
)
QueryLogs
(
user
user
.
Info
,
query
*
loggingv1alpha2
.
Query
)
(
*
loggingv1alpha2
.
APIResponse
,
error
)
{
iNamespaces
,
err
:=
t
.
listIntersectedNamespaces
(
user
,
iNamespaces
,
err
:=
t
.
listIntersectedNamespaces
(
stringutils
.
Split
(
query
.
WorkspaceFilter
,
","
),
stringutils
.
Split
(
query
.
WorkspaceSearch
,
","
),
stringutils
.
Split
(
query
.
NamespaceFilter
,
","
),
...
...
@@ -740,7 +740,7 @@ func (t *tenantOperator) QueryLogs(user user.Info, query *loggingv1alpha2.Query)
}
func
(
t
*
tenantOperator
)
ExportLogs
(
user
user
.
Info
,
query
*
loggingv1alpha2
.
Query
,
writer
io
.
Writer
)
error
{
iNamespaces
,
err
:=
t
.
listIntersectedNamespaces
(
user
,
iNamespaces
,
err
:=
t
.
listIntersectedNamespaces
(
stringutils
.
Split
(
query
.
WorkspaceFilter
,
","
),
stringutils
.
Split
(
query
.
WorkspaceSearch
,
","
),
stringutils
.
Split
(
query
.
NamespaceFilter
,
","
),
...
...
@@ -794,7 +794,7 @@ func (t *tenantOperator) ExportLogs(user user.Info, query *loggingv1alpha2.Query
}
func
(
t
*
tenantOperator
)
Auditing
(
user
user
.
Info
,
queryParam
*
auditingv1alpha1
.
Query
)
(
*
auditingv1alpha1
.
APIResponse
,
error
)
{
iNamespaces
,
err
:=
t
.
listIntersectedNamespaces
(
user
,
iNamespaces
,
err
:=
t
.
listIntersectedNamespaces
(
stringutils
.
Split
(
queryParam
.
WorkspaceFilter
,
","
),
stringutils
.
Split
(
queryParam
.
WorkspaceSearch
,
","
),
stringutils
.
Split
(
queryParam
.
ObjectRefNamespaceFilter
,
","
),
...
...
@@ -806,7 +806,7 @@ func (t *tenantOperator) Auditing(user user.Info, queryParam *auditingv1alpha1.Q
namespaceCreateTimeMap
:=
make
(
map
[
string
]
time
.
Time
)
// Now auditing and event have the same authori
ty management
, so we can determine whether the user
// Now auditing and event have the same authori
zation mechanism
, so we can determine whether the user
// has permission to view the auditing log in ns by judging whether the user has the permission to view the event in ns.
for
_
,
ns
:=
range
iNamespaces
{
listEvts
:=
authorizer
.
AttributesRecord
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录