mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
fix: 避免未能导出共享安全组规则
This commit is contained in:
@@ -196,8 +196,6 @@ type SecgroupResourceInput struct {
|
||||
|
||||
// 模糊匹配安全组规则名称
|
||||
SecgroupName string `json:"secgroup_name"`
|
||||
|
||||
apis.ProjectizedResourceInput
|
||||
}
|
||||
|
||||
type SecgroupFilterListInput struct {
|
||||
|
||||
@@ -118,14 +118,6 @@ func (manager *SSecurityGroupResourceBaseManager) ListItemFilter(
|
||||
sq := SecurityGroupManager.Query("id").Like("name", "%"+query.SecgroupName+"%")
|
||||
q = q.In("secgroup_id", sq.SubQuery())
|
||||
}
|
||||
if len(query.Project) > 0 {
|
||||
tenant, err := db.TenantCacheManager.FetchTenantByIdOrName(ctx, query.Project)
|
||||
if err != nil {
|
||||
return nil, httperrors.NewResourceNotFoundError2("projects", query.Project)
|
||||
}
|
||||
sq := SecurityGroupManager.Query("id").Equals("tenant_id", tenant.Id)
|
||||
q = q.In("secgroup_id", sq.SubQuery())
|
||||
}
|
||||
return q, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -123,12 +123,9 @@ func (manager *SSecurityGroupRuleManager) FetchOwnerId(ctx context.Context, data
|
||||
}
|
||||
|
||||
func (manager *SSecurityGroupRuleManager) FilterByOwner(q *sqlchemy.SQuery, userCred mcclient.IIdentityProvider, scope rbacutils.TRbacScope) *sqlchemy.SQuery {
|
||||
if userCred != nil {
|
||||
sq := SecurityGroupManager.Query("id")
|
||||
ssq := SecurityGroupManager.FilterByOwner(sq, userCred, scope)
|
||||
return q.In("secgroup_id", ssq.SubQuery())
|
||||
}
|
||||
return q
|
||||
sq := SecurityGroupManager.Query("id")
|
||||
sq = db.SharableManagerFilterByOwner(SecurityGroupManager, sq, userCred, scope)
|
||||
return q.In("secgroup_id", sq.SubQuery())
|
||||
}
|
||||
|
||||
func (manager *SSecurityGroupRuleManager) AllowCreateItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool {
|
||||
|
||||
Reference in New Issue
Block a user