Skip to content

Commit 11b0cca

Browse files
author
Simon Emms
committed
add seats param
1 parent 5876b19 commit 11b0cca

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

components/licensor/ee/pkg/licensor/licensor.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func (e *Evaluator) Enabled(feature Feature, seats int) bool {
173173
}
174174

175175
var ok bool
176-
if e.lic.Seats == 0 || seats <= e.lic.Seats {
176+
if e.HasEnoughSeats(seats) {
177177
// License has enough seats available - evaluate this license
178178
_, ok = e.lic.Level.allowance().Features[feature]
179179
} else {
@@ -186,8 +186,11 @@ func (e *Evaluator) Enabled(feature Feature, seats int) bool {
186186

187187
// HasEnoughSeats returns true if the license supports at least the give amount of seats
188188
func (e *Evaluator) HasEnoughSeats(seats int) bool {
189-
// Always return true - Enabled decides if we're on community or free/professional license
190-
return true
189+
if e.invalid != "" {
190+
return false
191+
}
192+
193+
return e.lic.Seats == 0 || seats <= e.lic.Seats
191194
}
192195

193196
// Inspect returns the license information this evaluator holds.

components/licensor/typescript/ee/main.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ func Enabled(id int, feature *C.char, seats int) (enabled, ok bool) {
6161
// HasEnoughSeats returns true if the license supports at least the given number of seats.
6262
//export HasEnoughSeats
6363
func HasEnoughSeats(id int, seats int) (permitted, ok bool) {
64-
e, ok := instances[id]
64+
_, ok = instances[id]
6565
if !ok {
6666
return
6767
}
6868

69-
return e.HasEnoughSeats(seats), true
69+
// Always return true - this logic is now part of the "Enabled" function
70+
return true, true
7071
}
7172

7273
// Inspect returns the license information this evaluator holds.

0 commit comments

Comments
 (0)