mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-08-29 03:51:54 +08:00
Merge pull request #6567 from swordqiu/hotfix/qj-default-policy-not-effective
fix: default policy not effective
This commit is contained in:
@@ -22,7 +22,6 @@ import (
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/netutils"
|
||||
"yunion.io/x/pkg/utils"
|
||||
)
|
||||
|
||||
type TRbacResult string
|
||||
@@ -591,7 +590,7 @@ func (policy *SRbacPolicy) IsSystemWidePolicy() bool {
|
||||
}
|
||||
|
||||
func (policy *SRbacPolicy) MatchDomain(domainId string) bool {
|
||||
if len(domainId) == 0 {
|
||||
if len(policy.DomainId) == 0 || len(domainId) == 0 {
|
||||
return true
|
||||
}
|
||||
if policy.DomainId == domainId {
|
||||
@@ -601,7 +600,7 @@ func (policy *SRbacPolicy) MatchDomain(domainId string) bool {
|
||||
if policy.PublicScope == ScopeSystem {
|
||||
return true
|
||||
}
|
||||
if utils.IsInStringArray(domainId, policy.SharedDomainIds) {
|
||||
if contains(policy.SharedDomainIds, domainId) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -609,7 +608,7 @@ func (policy *SRbacPolicy) MatchDomain(domainId string) bool {
|
||||
}
|
||||
|
||||
func (policy *SRbacPolicy) MatchProject(projectName string) bool {
|
||||
if len(policy.Projects) == 0 {
|
||||
if len(policy.Projects) == 0 || len(projectName) == 0 {
|
||||
return true
|
||||
}
|
||||
if contains(policy.Projects, projectName) {
|
||||
|
||||
Reference in New Issue
Block a user