mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
refactor(coderd/httpapi): remove database, dbauthz and rbac imports (#9481)
Ref: #9380
This commit is contained in:
committed by
GitHub
parent
d2115941b7
commit
6fc1f5276d
@ -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 {
|
||||
|
Reference in New Issue
Block a user