MCPcopy Index your code
hub / github.com/coder/coder / testDBAuthzRole

Function testDBAuthzRole

enterprise/coderd/coderd_test.go:937–953  ·  view source on GitHub ↗

testDBAuthzRole returns a context with a subject that has a role with permissions required for test setup.

(ctx context.Context)

Source from the content-addressed store, hash-verified

935// testDBAuthzRole returns a context with a subject that has a role
936// with permissions required for test setup.
937func testDBAuthzRole(ctx context.Context) context.Context {
938 return dbauthz.As(ctx, rbac.Subject{
939 ID: uuid.Nil.String(),
940 Roles: rbac.Roles([]rbac.Role{
941 {
942 Identifier: rbac.RoleIdentifier{Name: "testing"},
943 DisplayName: "Unit Tests",
944 Site: rbac.Permissions(map[string][]policy.Action{
945 rbac.ResourceWildcard.Type: {policy.WildcardSymbol},
946 }),
947 User: []rbac.Permission{},
948 ByOrgID: map[string]rbac.OrgPermissions{},
949 },
950 }),
951 Scope: rbac.ScopeAll,
952 })
953}
954
955// restartableListener is a TCP listener that can have all of it's connections
956// severed on demand.

Callers 1

TestEntitlementsFunction · 0.85

Calls 4

AsFunction · 0.92
RolesTypeAlias · 0.92
PermissionsFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected