mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: Add initial AuthzQuerier implementation (#5919)
feat: Add initial AuthzQuerier implementation - Adds package database/dbauthz that adds a database.Store implementation where each method goes through AuthZ checks - Implements all database.Store methods on AuthzQuerier - Updates and fixes unit tests where required - Updates coderd initialization to use AuthzQuerier if codersdk.ExperimentAuthzQuerier is enabled
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// Package dbauthz provides an authorization layer on top of the database. This
|
||||
// package exposes an interface that is currently a 1:1 mapping with
|
||||
// database.Store.
|
||||
//
|
||||
// The same cultural rules apply to this package as they do to database.Store.
|
||||
// Meaning that each method implemented should keep the number of database
|
||||
// queries as close to 1 as possible. Each method should do 1 thing, with no
|
||||
// unexpected side effects (eg: updating multiple tables in a single method).
|
||||
//
|
||||
// Do not implement business logic in this package. Only authorization related
|
||||
// logic should be implemented here. In most cases, this should only be a call to
|
||||
// the rbac authorizer.
|
||||
//
|
||||
// When a new database method is added to database.Store, it should be added to
|
||||
// this package as well. The unit test "Accounting" will ensure all methods are
|
||||
// tested. See other unit tests for examples on how to write these.
|
||||
package dbauthz
|
||||
Reference in New Issue
Block a user