mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: fail to reset policy org_node_id to empty (#19425)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -266,7 +266,10 @@ func listItemQueryFiltersRaw(manager IModelManager,
|
||||
return nil, httperrors.NewGeneralError(err)
|
||||
}
|
||||
|
||||
query.(*jsonutils.JSONDict).Update(policyTagFilters.Json())
|
||||
if !policyTagFilters.IsEmpty() {
|
||||
query.(*jsonutils.JSONDict).Update(policyTagFilters.Json())
|
||||
log.Debugf("policyTagFilers: %s", query)
|
||||
}
|
||||
|
||||
if !useRawQuery {
|
||||
// Specifically for joint resource, these filters will exclude
|
||||
@@ -1745,11 +1748,11 @@ func reflectDispatcherInternal(
|
||||
} else {
|
||||
if model != nil {
|
||||
if _, ok := model.(IStandaloneModel); ok {
|
||||
Metadata.rawSetValues(ctx, model.Keyword(), model.GetId(), tagutils.Tagset2MapString(result.ObjectTags.Flattern()), false, "")
|
||||
Metadata.rawSetValues(ctx, model.Keyword(), model.GetId(), tagutils.TagsetMap2MapString(result.ObjectTags.Flattern()), false, "")
|
||||
if model.Keyword() == "project" {
|
||||
Metadata.rawSetValues(ctx, model.Keyword(), model.GetId(), tagutils.Tagset2MapString(result.ProjectTags.Flattern()), false, "")
|
||||
Metadata.rawSetValues(ctx, model.Keyword(), model.GetId(), tagutils.TagsetMap2MapString(result.ProjectTags.Flattern()), false, "")
|
||||
} else if model.Keyword() == "domain" {
|
||||
Metadata.rawSetValues(ctx, model.Keyword(), model.GetId(), tagutils.Tagset2MapString(result.DomainTags.Flattern()), false, "")
|
||||
Metadata.rawSetValues(ctx, model.Keyword(), model.GetId(), tagutils.TagsetMap2MapString(result.DomainTags.Flattern()), false, "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,12 +722,12 @@ func (model *SStandaloneAnonResourceBase) applyPolicyTags(ctx context.Context, u
|
||||
data.Unmarshal(&tags)
|
||||
log.Debugf("applyPolicyTags: %s", jsonutils.Marshal(tags))
|
||||
if len(tags.PolicyObjectTags) > 0 {
|
||||
model.PerformMetadata(ctx, userCred, nil, tagutils.Tagset2MapString(tags.PolicyObjectTags.Flattern()))
|
||||
model.PerformMetadata(ctx, userCred, nil, tagutils.TagsetMap2MapString(tags.PolicyObjectTags.Flattern()))
|
||||
}
|
||||
if model.Keyword() == "project" && len(tags.PolicyProjectTags) > 0 {
|
||||
model.PerformMetadata(ctx, userCred, nil, tagutils.Tagset2MapString(tags.PolicyProjectTags.Flattern()))
|
||||
model.PerformMetadata(ctx, userCred, nil, tagutils.TagsetMap2MapString(tags.PolicyProjectTags.Flattern()))
|
||||
} else if model.Keyword() == "domain" && len(tags.PolicyDomainTags) > 0 {
|
||||
model.PerformMetadata(ctx, userCred, nil, tagutils.Tagset2MapString(tags.PolicyDomainTags.Flattern()))
|
||||
model.PerformMetadata(ctx, userCred, nil, tagutils.TagsetMap2MapString(tags.PolicyDomainTags.Flattern()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user