Skip to content

Commit b4beb38

Browse files
committed
Call compileToSQL in getWorkspaces
1 parent f45a170 commit b4beb38

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

coderd/database/databasefake/databasefake.go

+13
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,12 @@ func (q *fakeQuerier) GetAuthorizedUserCount(ctx context.Context, params databas
611611
q.mutex.RLock()
612612
defer q.mutex.RUnlock()
613613

614+
// Call this to match the same function calls as the SQL implementation.
615+
_, err := prepared.CompileToSQL(ctx, rbac.ConfigWithoutACL())
616+
if err != nil {
617+
return nil, err
618+
}
619+
614620
users := make([]database.User, 0, len(q.users))
615621

616622
for _, user := range q.users {
@@ -889,6 +895,7 @@ func (q *fakeQuerier) GetAuthorizedWorkspaces(ctx context.Context, arg database.
889895
q.mutex.RLock()
890896
defer q.mutex.RUnlock()
891897

898+
// Call this to match the same function calls as the SQL implementation.
892899
_, err := prepared.CompileToSQL(ctx, rbac.ConfigWithoutACL())
893900
if err != nil {
894901
return nil, err
@@ -1700,6 +1707,12 @@ func (q *fakeQuerier) GetAuthorizedTemplates(ctx context.Context, arg database.G
17001707
q.mutex.RLock()
17011708
defer q.mutex.RUnlock()
17021709

1710+
// Call this to match the same function calls as the SQL implementation.
1711+
_, err := prepared.CompileToSQL(ctx, rbac.ConfigWithoutACL())
1712+
if err != nil {
1713+
return nil, err
1714+
}
1715+
17031716
var templates []database.Template
17041717
for _, template := range q.templates {
17051718
if prepared != nil && prepared.Authorize(ctx, template.RBACObject()) != nil {

0 commit comments

Comments
 (0)