Skip to content

Commit 99d10f5

Browse files
fix: check rbac on env if envName is present (#5765)
* admin check fix in config draft * minor fix
1 parent 7ee4a32 commit 99d10f5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

api/restHandler/DeploymentConfigurationRestHandler.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,11 @@ func (handler *DeploymentConfigurationRestHandlerImpl) enforceForAppAndEnv(appNa
115115
return false
116116
}
117117

118-
object = handler.enforcerUtil.GetEnvRBACNameByAppAndEnvName(appName, envName)
119-
if ok := handler.enforcer.Enforce(token, casbin.ResourceEnvironment, action, object); !ok {
120-
return false
118+
if len(envName) > 0 {
119+
object = handler.enforcerUtil.GetEnvRBACNameByAppAndEnvName(appName, envName)
120+
if ok := handler.enforcer.Enforce(token, casbin.ResourceEnvironment, action, object); !ok {
121+
return false
122+
}
121123
}
122124
return true
123125
}

pkg/configDiff/DeploymentConfigurationService.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func (impl *DeploymentConfigurationServiceImpl) ConfigAutoComplete(appId int, en
6363
if _, ok := cmcsKeyPropertyEnvLevelMap[key]; !ok {
6464
if envId > 0 {
6565
configProperty.ConfigStage = bean2.Inheriting
66+
configProperty.Id = 0
6667
}
6768

6869
}

0 commit comments

Comments
 (0)