Auth: Add anonymous users view and stats (#78685)

* Add anonymous stats and user table

- anonymous users users page
- add feature toggle `anonymousAccess`
- remove check for enterprise for `Device-Id` header in request
- add anonusers/device count to stats

* promise all, review comments

* make use of promise all settled

* refactoring: devices instead of users

* review comments, moved countdevices to httpserver

* fakeAnonService for tests and generate openapi spec

* do not commit openapi3 and api-merged

* add openapi

* Apply suggestions from code review

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* formatin

* precise anon devices to avoid confusion

---------

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
Co-authored-by: jguer <me@jguer.space>
This commit is contained in:
Eric Leijonmarck
2023-11-29 17:58:41 +01:00
committed by GitHub
co-authored by Alex Khomenko jguer
parent fd863cfc93
commit 59bdff0280
30 changed files with 548 additions and 21 deletions
@@ -21,11 +21,11 @@ type AnonDBStore struct {
type Device struct {
ID int64 `json:"-" xorm:"id" db:"id"`
DeviceID string `json:"device_id" xorm:"device_id" db:"device_id"`
ClientIP string `json:"client_ip" xorm:"client_ip" db:"client_ip"`
UserAgent string `json:"user_agent" xorm:"user_agent" db:"user_agent"`
CreatedAt time.Time `json:"created_at" xorm:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" xorm:"updated_at" db:"updated_at"`
DeviceID string `json:"deviceId" xorm:"device_id" db:"device_id"`
ClientIP string `json:"clientIp" xorm:"client_ip" db:"client_ip"`
UserAgent string `json:"userAgent" xorm:"user_agent" db:"user_agent"`
CreatedAt time.Time `json:"createdAt" xorm:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updatedAt" xorm:"updated_at" db:"updated_at"`
}
func (a *Device) CacheKey() string {