Skip to content

Commit dcf3b27

Browse files
committed
Implement GetCryptoKeysByFeature method
Add authorization check and call database method.
1 parent c42722d commit dcf3b27

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

coderd/database/dbauthz/dbauthz.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,10 @@ func (q *querier) GetCryptoKeys(ctx context.Context) ([]database.CryptoKey, erro
14061406
}
14071407

14081408
func (q *querier) GetCryptoKeysByFeature(ctx context.Context, feature database.CryptoKeyFeature) ([]database.CryptoKey, error) {
1409-
panic("not implemented")
1409+
if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceCryptoKey); err != nil {
1410+
return nil, err
1411+
}
1412+
return q.db.GetCryptoKeysByFeature(ctx, feature)
14101413
}
14111414

14121415
func (q *querier) GetDBCryptKeys(ctx context.Context) ([]database.DBCryptKey, error) {

coderd/keychain/dbkeychain_internal_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/coder/quartz"
1515
)
1616

17-
func Test_version(t *testing.T) {
17+
func Test_Version(t *testing.T) {
1818
t.Parallel()
1919

2020
t.Run("HitsCache", func(t *testing.T) {
@@ -165,7 +165,7 @@ func Test_version(t *testing.T) {
165165
})
166166
}
167167

168-
func Test_latest(t *testing.T) {
168+
func Test_Latest(t *testing.T) {
169169
t.Parallel()
170170

171171
t.Run("HitsCache", func(t *testing.T) {

0 commit comments

Comments
 (0)