Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
229660230
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
229660230
Commits
deaa4318
Commit
deaa4318
authored
3 years ago
by
ioito
Browse files
Options
Downloads
Patches
Plain Diff
fix(region): lb filter by owner
parent
e34399fe
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pkg/compute/models/loadbalancerbackendgroups.go
+16
-0
16 additions, 0 deletions
pkg/compute/models/loadbalancerbackendgroups.go
pkg/compute/models/loadbalancerlisteners.go
+16
-0
16 additions, 0 deletions
pkg/compute/models/loadbalancerlisteners.go
with
32 additions
and
0 deletions
pkg/compute/models/loadbalancerbackendgroups.go
+
16
−
0
View file @
deaa4318
...
...
@@ -36,6 +36,7 @@ import (
"yunion.io/x/onecloud/pkg/httperrors"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/util/rand"
"yunion.io/x/onecloud/pkg/util/rbacutils"
"yunion.io/x/onecloud/pkg/util/stringutils2"
)
...
...
@@ -79,6 +80,21 @@ func (man *SLoadbalancerBackendGroupManager) pendingDeleteSubs(ctx context.Conte
}
}
func
(
man
*
SLoadbalancerBackendGroupManager
)
FilterByOwner
(
q
*
sqlchemy
.
SQuery
,
userCred
mcclient
.
IIdentityProvider
,
scope
rbacutils
.
TRbacScope
)
*
sqlchemy
.
SQuery
{
if
userCred
!=
nil
{
sq
:=
LoadbalancerManager
.
Query
(
"id"
)
switch
scope
{
case
rbacutils
.
ScopeProject
:
sq
=
sq
.
Equals
(
"tenant_id"
,
userCred
.
GetProjectId
())
return
q
.
In
(
"loadbalancer_id"
,
sq
.
SubQuery
())
case
rbacutils
.
ScopeDomain
:
sq
=
sq
.
Equals
(
"domain_id"
,
userCred
.
GetProjectDomainId
())
return
q
.
In
(
"loadbalancer_id"
,
sq
.
SubQuery
())
}
}
return
q
}
// 负载均衡后端服务器组列表
func
(
man
*
SLoadbalancerBackendGroupManager
)
ListItemFilter
(
ctx
context
.
Context
,
...
...
This diff is collapsed.
Click to expand it.
pkg/compute/models/loadbalancerlisteners.go
+
16
−
0
View file @
deaa4318
...
...
@@ -36,6 +36,7 @@ import (
"yunion.io/x/onecloud/pkg/cloudprovider"
"yunion.io/x/onecloud/pkg/httperrors"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/util/rbacutils"
"yunion.io/x/onecloud/pkg/util/stringutils2"
)
...
...
@@ -211,6 +212,21 @@ func (man *SLoadbalancerListenerManager) pendingDeleteSubs(ctx context.Context,
}
}
func
(
man
*
SLoadbalancerListenerManager
)
FilterByOwner
(
q
*
sqlchemy
.
SQuery
,
userCred
mcclient
.
IIdentityProvider
,
scope
rbacutils
.
TRbacScope
)
*
sqlchemy
.
SQuery
{
if
userCred
!=
nil
{
sq
:=
LoadbalancerManager
.
Query
(
"id"
)
switch
scope
{
case
rbacutils
.
ScopeProject
:
sq
=
sq
.
Equals
(
"tenant_id"
,
userCred
.
GetProjectId
())
return
q
.
In
(
"loadbalancer_id"
,
sq
.
SubQuery
())
case
rbacutils
.
ScopeDomain
:
sq
=
sq
.
Equals
(
"domain_id"
,
userCred
.
GetProjectDomainId
())
return
q
.
In
(
"loadbalancer_id"
,
sq
.
SubQuery
())
}
}
return
q
}
// 负载均衡监听器Listener列表
func
(
man
*
SLoadbalancerListenerManager
)
ListItemFilter
(
ctx
context
.
Context
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment