未验证 提交 d194fc81 编写于 作者: S shendongdong 提交者: GitHub

fix workflow create auth error (#2961)

* fix workflow create auth error
Signed-off-by: Nallenshen <shendongdong@koderover.com>

* fix workflow create auth error
Signed-off-by: Nallenshen <shendongdong@koderover.com>

* update project key
Signed-off-by: Nallenshen <shendongdong@koderover.com>

* remove debug log
Signed-off-by: Nallenshen <shendongdong@koderover.com>

---------
Signed-off-by: Nallenshen <shendongdong@koderover.com>
上级 72478c8a
...@@ -41,9 +41,16 @@ func GetWorkflowTemplateByID(c *gin.Context) { ...@@ -41,9 +41,16 @@ func GetWorkflowTemplateByID(c *gin.Context) {
// authorization check // authorization check
if !ctx.Resources.IsSystemAdmin { if !ctx.Resources.IsSystemAdmin {
if !ctx.Resources.SystemActions.Template.View { if !ctx.Resources.SystemActions.Template.View {
ctx.UnAuthorized = true projectKey := c.Param("projectName")
internalhandler.JSONResponse(c, ctx) if _, ok := ctx.Resources.ProjectAuthInfo[projectKey]; !ok {
return ctx.UnAuthorized = true
return
}
if !ctx.Resources.ProjectAuthInfo[projectKey].IsProjectAdmin &&
!ctx.Resources.ProjectAuthInfo[projectKey].Workflow.Create {
ctx.UnAuthorized = true
return
}
} }
} }
...@@ -70,8 +77,16 @@ func ListWorkflowTemplate(c *gin.Context) { ...@@ -70,8 +77,16 @@ func ListWorkflowTemplate(c *gin.Context) {
// authorization check // authorization check
if !ctx.Resources.IsSystemAdmin { if !ctx.Resources.IsSystemAdmin {
if !ctx.Resources.SystemActions.Template.View { if !ctx.Resources.SystemActions.Template.View {
ctx.UnAuthorized = true projectKey := c.Param("projectName")
return if _, ok := ctx.Resources.ProjectAuthInfo[projectKey]; !ok {
ctx.UnAuthorized = true
return
}
if !ctx.Resources.ProjectAuthInfo[projectKey].IsProjectAdmin &&
!ctx.Resources.ProjectAuthInfo[projectKey].Workflow.Create {
ctx.UnAuthorized = true
return
}
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册