mirror of
https://github.com/openziti/zrok.git
synced 2025-08-13 17:57:37 +02:00
infrastructure for detecting limited accounts (#320)
This commit is contained in:
@ -84,8 +84,20 @@ func overviewHandler(_ metadata.OverviewParams, principal *rest_model_zrok.Princ
|
||||
}
|
||||
envShrsList = append(envShrsList, envShrs)
|
||||
}
|
||||
var alj *store.AccountLimitJournal
|
||||
aljEmpty, err := str.IsAccountLimitJournalEmpty(int(principal.ID), tx)
|
||||
if err != nil {
|
||||
logrus.Errorf("error checking account limit journal for '%v': %v", principal.Email, err)
|
||||
}
|
||||
if !aljEmpty {
|
||||
alj, err = str.FindLatestAccountLimitJournal(int(principal.ID), tx)
|
||||
if err != nil {
|
||||
logrus.Errorf("error getting latest account limit journal entry for '%v': %v", principal.Email, err)
|
||||
return metadata.NewOverviewInternalServerError()
|
||||
}
|
||||
}
|
||||
return metadata.NewOverviewOK().WithPayload(&rest_model_zrok.Overview{
|
||||
AccountLimited: false,
|
||||
AccountLimited: alj != nil && alj.Action == store.LimitAction,
|
||||
Environments: envShrsList,
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user