fix: new user without porject may view any resources

This commit is contained in:
Qiu Jian
2019-08-17 13:35:25 +08:00
parent fa1cbe4704
commit e50f63a494
4 changed files with 5 additions and 11 deletions
+1 -3
View File
@@ -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
+2 -6
View File
@@ -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())
+1 -1
View File
@@ -416,4 +416,4 @@ func (self *SSnapshotPolicy) preCheck(
return nil, httperrors.NewNotFoundError("Disks %v not found", notFoundDisks)
}
return diskIds, nil
}
}
+1 -1
View File
@@ -73,4 +73,4 @@ func TestIntArray2Uint(t *testing.T) {
t.Fatalf("want %d, but %d\n", tc.want, real)
}
}
}
}