mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: push rbac actions to policy package (#13274)
Just moved `rbac.Action` -> `policy.Action`. This is for the stacked PR to not have circular dependencies when doing autogen. Without this, the autogen can produce broken golang code, which prevents the autogen from compiling. So just avoiding circular dependencies. Doing this in it's own PR to reduce LoC diffs in the primary PR, since this has 0 functional changes.
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/coder/coder/v2/coderd/httpapi/httpapiconstraints"
|
||||
"github.com/coder/coder/v2/coderd/rbac/policy"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -28,7 +29,7 @@ type UnauthorizedError struct {
|
||||
|
||||
// These fields are for debugging purposes.
|
||||
subject Subject
|
||||
action Action
|
||||
action policy.Action
|
||||
// Note only the object type is set for partial execution.
|
||||
object Object
|
||||
|
||||
@@ -52,7 +53,7 @@ func IsUnauthorizedError(err error) bool {
|
||||
// ForbiddenWithInternal creates a new error that will return a simple
|
||||
// "forbidden" to the client, logging internally the more detailed message
|
||||
// provided.
|
||||
func ForbiddenWithInternal(internal error, subject Subject, action Action, object Object, output rego.ResultSet) *UnauthorizedError {
|
||||
func ForbiddenWithInternal(internal error, subject Subject, action policy.Action, object Object, output rego.ResultSet) *UnauthorizedError {
|
||||
return &UnauthorizedError{
|
||||
internal: internal,
|
||||
subject: subject,
|
||||
|
||||
Reference in New Issue
Block a user