refactor(coderd/httpapi): remove database, dbauthz and rbac imports (#9481)

Ref: #9380
This commit is contained in:
Mathias Fredriksson
2023-09-04 19:39:14 +03:00
committed by GitHub
parent d2115941b7
commit 6fc1f5276d
5 changed files with 40 additions and 7 deletions

View File

@ -9,6 +9,8 @@ import (
"github.com/open-policy-agent/opa/rego"
"github.com/open-policy-agent/opa/topdown"
"golang.org/x/xerrors"
"github.com/coder/coder/v2/coderd/httpapi/httpapiconstraints"
)
const (
@ -33,6 +35,14 @@ type UnauthorizedError struct {
output rego.ResultSet
}
// Ensure we implement the IsUnauthorized interface.
var _ httpapiconstraints.IsUnauthorizedError = (*UnauthorizedError)(nil)
// IsUnauthorized implements the IsUnauthorized interface.
func (UnauthorizedError) IsUnauthorized() bool {
return true
}
// IsUnauthorizedError is a convenience function to check if err is UnauthorizedError.
// It is equivalent to errors.As(err, &UnauthorizedError{}).
func IsUnauthorizedError(err error) bool {