File tree 1 file changed +19
-2
lines changed
components/licensor/ee/pkg/licensor
1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -117,9 +117,18 @@ func (lvl LicenseLevel) allowance() allowance {
117
117
return a
118
118
}
119
119
120
+ // Fallback license is used when the instance exceeds the number of licenses - it allows limited access
121
+ var fallbackLicense = LicensePayload {
122
+ ID : "fallback-license" ,
123
+ Level : LevelTeam ,
124
+ Seats : 0 ,
125
+ // Domain, ValidUntil are free for all
126
+ }
127
+
128
+ // Default license is used when no valid license is given - it allows full access up to 10 users
120
129
var defaultLicense = LicensePayload {
121
130
ID : "default-license" ,
122
- Level : LevelTeam ,
131
+ Level : LevelEnterprise ,
123
132
Seats : 10 ,
124
133
// Domain, ValidUntil are free for all
125
134
}
@@ -163,7 +172,15 @@ func (e *Evaluator) Enabled(feature Feature, seats int) bool {
163
172
return false
164
173
}
165
174
166
- _ , ok := e .lic .Level .allowance ().Features [feature ]
175
+ var ok bool
176
+ if e .lic .Seats == 0 || seats <= e .lic .Seats {
177
+ // License has enough seats available - evaluate this license
178
+ _ , ok = e .lic .Level .allowance ().Features [feature ]
179
+ } else {
180
+ // License has run out of seats - use the fallback license
181
+ _ , ok = fallbackLicense .Level .allowance ().Features [feature ]
182
+ }
183
+
167
184
return ok
168
185
}
169
186
You can’t perform that action at this time.
0 commit comments