Skip to content

Commit

Permalink
Merge pull request #3913 from PetrusZ/ft/improve_bizdir
Browse files Browse the repository at this point in the history
fix service label auth in bizdir
  • Loading branch information
jamsman94 authored Dec 25, 2024
2 parents 5997727 + 03a24b6 commit 3a15f99
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions pkg/microservice/aslan/core/service/handler/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1326,21 +1326,24 @@ func ListServiceLabels(c *gin.Context) {
}

if !ctx.Resources.IsSystemAdmin {
if _, ok := ctx.Resources.ProjectAuthInfo[req.ProjectKey]; !ok {
ctx.UnAuthorized = true
return
}
if boolptr.IsTrue(production) {
if !ctx.Resources.ProjectAuthInfo[req.ProjectKey].IsProjectAdmin &&
!ctx.Resources.ProjectAuthInfo[req.ProjectKey].ProductionService.View {
if !ctx.Resources.SystemActions.BusinessDirectory.View {
if _, ok := ctx.Resources.ProjectAuthInfo[req.ProjectKey]; !ok {
ctx.UnAuthorized = true
return
}
} else {
if !ctx.Resources.ProjectAuthInfo[req.ProjectKey].IsProjectAdmin &&
!ctx.Resources.ProjectAuthInfo[req.ProjectKey].Service.View {
ctx.UnAuthorized = true
return

if boolptr.IsTrue(production) {
if !ctx.Resources.ProjectAuthInfo[req.ProjectKey].IsProjectAdmin &&
!ctx.Resources.ProjectAuthInfo[req.ProjectKey].ProductionService.View {
ctx.UnAuthorized = true
return
}
} else {
if !ctx.Resources.ProjectAuthInfo[req.ProjectKey].IsProjectAdmin &&
!ctx.Resources.ProjectAuthInfo[req.ProjectKey].Service.View {
ctx.UnAuthorized = true
return
}
}
}
}
Expand Down

0 comments on commit 3a15f99

Please sign in to comment.