fix(keystone): hide system scope policies in domain scope view (#10194)

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
Jian Qiu
2021-02-08 12:16:45 -03:00
committed by GitHub
co-authored by Qiu Jian
parent 3bb48e9371
commit 010049e5e3
+8 -1
View File
@@ -547,7 +547,14 @@ func (policy *SPolicy) GetUsages() []db.IUsage {
}
func (manager *SPolicyManager) FilterByOwner(q *sqlchemy.SQuery, owner mcclient.IIdentityProvider, scope rbacutils.TRbacScope) *sqlchemy.SQuery {
return db.SharableManagerFilterByOwner(manager, q, owner, scope)
q = db.SharableManagerFilterByOwner(manager, q, owner, scope)
switch scope {
case rbacutils.ScopeProject:
q = q.Equals("scope", rbacutils.ScopeProject)
case rbacutils.ScopeDomain:
q = q.NotEquals("scope", rbacutils.ScopeSystem)
}
return q
}
func (policy *SPolicy) GetSharableTargetDomainIds() []string {