Add Service Banners (#5272)

This commit is contained in:
Ammar Bandukwala
2022-12-06 18:38:38 +00:00
committed by GitHub
parent df389d429c
commit 1cfe5de1c5
36 changed files with 959 additions and 4 deletions
@@ -113,6 +113,7 @@ type LicenseOptions struct {
HighAvailability bool
MultipleGitAuth bool
ExternalProvisionerDaemons bool
ServiceBanners bool
}
// AddLicense generates a new license with the options provided and inserts it.
@@ -164,6 +165,11 @@ func GenerateLicense(t *testing.T, options LicenseOptions) string {
externalProvisionerDaemons = 1
}
serviceBanners := int64(0)
if options.ServiceBanners {
serviceBanners = 1
}
c := &license.Claims{
RegisteredClaims: jwt.RegisteredClaims{
Issuer: "test@testing.test",
@@ -186,6 +192,7 @@ func GenerateLicense(t *testing.T, options LicenseOptions) string {
TemplateRBAC: rbacEnabled,
MultipleGitAuth: multipleGitAuth,
ExternalProvisionerDaemons: externalProvisionerDaemons,
ServiceBanners: serviceBanners,
},
}
tok := jwt.NewWithClaims(jwt.SigningMethodEdDSA, c)
@@ -49,6 +49,7 @@ func TestAuthorizeAllEndpoints(t *testing.T) {
skipRoutes, assertRoute := coderdtest.AGPLRoutes(a)
skipRoutes["GET:/api/v2/organizations/{organization}/provisionerdaemons/serve"] = "This route checks for RBAC dependent on input parameters!"
skipRoutes["GET:/api/v2/service-banner/"] = "This route is available to all users"
assertRoute["GET:/api/v2/entitlements"] = coderdtest.RouteCheck{
NoAuthorize: true,