Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

If caller is requesting for database list under a project, then we should return all databases

天舟318f102a64de
diff --git a/server/database.go b/server/database.go
index f6b80a36c0..088c7501e6 100644
--- a/server/database.go
+++ b/server/database.go
@@ -71,13 +71,14 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
filteredList := []*api.Database{}
role := c.Get(GetRoleContextKey()).(api.Role)
- // If caller is NOT requesting for a paritcular instance or the caller is a Developer,
- // then we will only return databases belonging to the project where the caller is a member of.
+ // If caller is NOT requesting for a particular project and is NOT requesting for a paritcular
+ // instance or the caller is a Developer, then we will only return databases belonging to the
+ // project where the caller is a member of.
// Looking from the UI perspective:
// - The database list left sidebar will only return databases related to the caller regardless of the caller's role.
// - The database list on the instance page will return all databases if the caller is Owner or DBA, but will only return
// related databases if the caller is Developer.
- if databaseFind.InstanceId == nil || role == api.Developer {
+ if projectIdStr == "" && (databaseFind.InstanceId == nil || role == api.Developer) {
principalId := c.Get(GetPrincipalIdContextKey()).(int)
for _, database := range list {
for _, projectMember := range database.Project.ProjectMemberList {