mirror of
https://github.com/openziti/zrok.git
synced 2025-08-16 10:57:55 +02:00
fix for scoped bandwidth limits in agent.CanCreateShare; make relax actions error without failing (#606, #451)
This commit is contained in:
@ -87,15 +87,24 @@ func (a *Agent) CanCreateShare(acctId, envId int, reserved, uniqueName bool, _ s
|
||||
return false, err
|
||||
}
|
||||
|
||||
bwcs := ul.toBandwidthArray(backendMode)
|
||||
for _, bwc := range bwcs {
|
||||
latestJe, err := a.isBandwidthClassLimitedForAccount(acctId, bwc, trx)
|
||||
if scopedBwc, found := ul.scopes[backendMode]; found {
|
||||
latestScopedJe, err := a.isBandwidthClassLimitedForAccount(acctId, scopedBwc, trx)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if latestJe != nil {
|
||||
if latestScopedJe != nil {
|
||||
return false, nil
|
||||
}
|
||||
} else {
|
||||
for _, bwc := range ul.bandwidth {
|
||||
latestJe, err := a.isBandwidthClassLimitedForAccount(acctId, bwc, trx)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if latestJe != nil {
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ul.resource.GetShares() > store.Unlimited || (reserved && ul.resource.GetReservedShares() > store.Unlimited) || (reserved && uniqueName && ul.resource.GetUniqueNames() > store.Unlimited) {
|
||||
|
Reference in New Issue
Block a user