mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-08-31 01:35:56 +08:00
fix: new user without porject may view any resources
This commit is contained in:
@@ -42,9 +42,7 @@ func (manager *SDomainizedResourceBaseManager) FilterByOwner(q *sqlchemy.SQuery,
|
||||
if owner != nil {
|
||||
switch scope {
|
||||
case rbacutils.ScopeDomain:
|
||||
if len(owner.GetProjectDomainId()) > 0 {
|
||||
q = q.Equals("domain_id", owner.GetProjectDomainId())
|
||||
}
|
||||
q = q.Equals("domain_id", owner.GetProjectDomainId())
|
||||
}
|
||||
}
|
||||
return q
|
||||
|
||||
@@ -42,13 +42,9 @@ func (manager *SProjectizedResourceBaseManager) FilterByOwner(q *sqlchemy.SQuery
|
||||
if owner != nil {
|
||||
switch scope {
|
||||
case rbacutils.ScopeProject:
|
||||
if len(owner.GetProjectId()) > 0 {
|
||||
q = q.Equals("tenant_id", owner.GetProjectId())
|
||||
}
|
||||
q = q.Equals("tenant_id", owner.GetProjectId())
|
||||
case rbacutils.ScopeDomain:
|
||||
if len(owner.GetProjectDomainId()) > 0 {
|
||||
q = q.Equals("domain_id", owner.GetProjectDomainId())
|
||||
}
|
||||
q = q.Equals("domain_id", owner.GetProjectDomainId())
|
||||
}
|
||||
/*if len(owner.GetProjectId()) > 0 {
|
||||
q = q.Equals("tenant_id", owner.GetProjectId())
|
||||
|
||||
@@ -416,4 +416,4 @@ func (self *SSnapshotPolicy) preCheck(
|
||||
return nil, httperrors.NewNotFoundError("Disks %v not found", notFoundDisks)
|
||||
}
|
||||
return diskIds, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,4 +73,4 @@ func TestIntArray2Uint(t *testing.T) {
|
||||
t.Fatalf("want %d, but %d\n", tc.want, real)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user