mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
fix: isolated_devices domain filter not working
This commit is contained in:
@@ -102,7 +102,7 @@ type SGuest struct {
|
||||
SBillingResourceBase
|
||||
SDeletePreventableResourceBase
|
||||
|
||||
SHostResourceBase `width:"36" charset:"ascii" nullable:"true" list:"admin" get:"admin" index:"true"`
|
||||
SHostResourceBase `width:"36" charset:"ascii" nullable:"true" list:"user" get:"user" index:"true"`
|
||||
|
||||
// CPU大小
|
||||
VcpuCount int `nullable:"false" default:"1" list:"user" create:"optional"`
|
||||
@@ -138,7 +138,7 @@ type SGuest struct {
|
||||
// example: default
|
||||
SecgrpId string `width:"36" charset:"ascii" nullable:"true" get:"user" create:"optional"`
|
||||
// 管理员可见安全组Id
|
||||
AdminSecgrpId string `width:"36" charset:"ascii" nullable:"true" get:"admin"`
|
||||
AdminSecgrpId string `width:"36" charset:"ascii" nullable:"true" get:"domain"`
|
||||
|
||||
SrcIpCheck tristate.TriState `nullable:"false" default:"true" create:"optional" list:"user" update:"user"`
|
||||
SrcMacCheck tristate.TriState `nullable:"false" default:"true" create:"optional" list:"user" update:"user"`
|
||||
|
||||
@@ -759,9 +759,10 @@ func (manager *SIsolatedDeviceManager) FilterByOwner(q *sqlchemy.SQuery, owner m
|
||||
if owner != nil {
|
||||
switch scope {
|
||||
case rbacutils.ScopeProject, rbacutils.ScopeDomain:
|
||||
hosts := HostManager.Query("id", "domain_id").SubQuery()
|
||||
hostsQ := HostManager.Query("id")
|
||||
hostsQ = HostManager.FilterByOwner(hostsQ, owner, scope)
|
||||
hosts := hostsQ.SubQuery()
|
||||
q = q.Join(hosts, sqlchemy.Equals(q.Field("host_id"), hosts.Field("id")))
|
||||
q = q.Filter(sqlchemy.Equals(hosts.Field("domain_id"), owner.GetProjectDomainId()))
|
||||
}
|
||||
}
|
||||
return q
|
||||
|
||||
Reference in New Issue
Block a user