Skip to content

Commit

Permalink
[license] adjust users of self-hosted license
Browse files Browse the repository at this point in the history
Related to #5314
  • Loading branch information
laushinka authored and roboquat committed Aug 31, 2021
1 parent 5439643 commit 0e270bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 6 additions & 3 deletions components/licensor/ee/pkg/licensor/licensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ type licensePayload struct {
type LicenseLevel int

const (
// LevelTeam is the default license level
// LevelTeam is the default license level,
// which is the free tier
LevelTeam LicenseLevel = 0

// LevelEnterprise enables enterprise features
// LevelEnterprise enables enterprise features,
// which applies after buying a license
LevelEnterprise LicenseLevel = 1
)

Expand Down Expand Up @@ -109,7 +111,8 @@ func (lvl LicenseLevel) allowance() allowance {
var defaultLicense = LicensePayload{
ID: "default-license",
Level: LevelTeam,
// Seats, Domain, ValidUntil are free for all
Seats: 10,
// Domain, ValidUntil are free for all
}

// NewEvaluator produces a new license evaluator from a license key
Expand Down
6 changes: 6 additions & 0 deletions components/licensor/ee/pkg/licensor/licensor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ func TestSeats(t *testing.T) {
{"beyond limited seats", 50, 150, false, false, false},
{"beyond limited seats (edge)", 50, 51, false, false, false},
{"invalid license", 50, 50, false, false, true},
{"within default license seats", 0, 7, true, true, false},
{"within default license seats (edge)", 0, 10, true, true, false},
{"beyond default license seats", 0, 11, false, true, false},
}

for _, test := range tests {
Expand All @@ -85,6 +88,9 @@ func TestSeats(t *testing.T) {
}
},
}
if test.DefaultLicense {
lt.License = nil
}
lt.Run(t)
}
}
Expand Down

0 comments on commit 0e270bc

Please sign in to comment.