mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
chore: include custom roles in list org roles (#13336)
* chore: include custom roles in list org roles * move cli show roles to org scope
This commit is contained in:
@ -8,6 +8,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -817,6 +818,19 @@ func OAuth2ProviderAppToken(t testing.TB, db database.Store, seed database.OAuth
|
||||
return token
|
||||
}
|
||||
|
||||
func CustomRole(t testing.TB, db database.Store, seed database.CustomRole) database.CustomRole {
|
||||
role, err := db.UpsertCustomRole(genCtx, database.UpsertCustomRoleParams{
|
||||
Name: takeFirst(seed.Name, strings.ToLower(namesgenerator.GetRandomName(1))),
|
||||
DisplayName: namesgenerator.GetRandomName(1),
|
||||
OrganizationID: seed.OrganizationID,
|
||||
SitePermissions: takeFirstSlice(seed.SitePermissions, []byte("[]")),
|
||||
OrgPermissions: takeFirstSlice(seed.SitePermissions, []byte("{}")),
|
||||
UserPermissions: takeFirstSlice(seed.SitePermissions, []byte("[]")),
|
||||
})
|
||||
require.NoError(t, err, "insert custom role")
|
||||
return role
|
||||
}
|
||||
|
||||
func must[V any](v V, err error) V {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
Reference in New Issue
Block a user