mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
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
38 lines
441 B
SQL
38 lines
441 B
SQL
-- name: InsertLicense :one
|
|
INSERT INTO
|
|
licenses (
|
|
uploaded_at,
|
|
jwt,
|
|
exp,
|
|
uuid
|
|
)
|
|
VALUES
|
|
($1, $2, $3, $4) RETURNING *;
|
|
|
|
-- name: GetLicenses :many
|
|
SELECT *
|
|
FROM licenses
|
|
ORDER BY (id);
|
|
|
|
-- name: GetLicenseByID :one
|
|
SELECT
|
|
*
|
|
FROM
|
|
licenses
|
|
WHERE
|
|
id = $1
|
|
LIMIT
|
|
1;
|
|
|
|
-- name: GetUnexpiredLicenses :many
|
|
SELECT *
|
|
FROM licenses
|
|
WHERE exp > NOW()
|
|
ORDER BY (id);
|
|
|
|
-- name: DeleteLicense :one
|
|
DELETE
|
|
FROM licenses
|
|
WHERE id = $1
|
|
RETURNING id;
|