config.gno
0.89 Kb · 43 lines
1package user
2
3import (
4 "chain"
5 "strconv"
6
7 "gno.land/p/g1nqnrt3aldzhu6zzeg75yw97wvavqy7wr77g56q/deploy-test/v0/v0/accesscontrol"
8 "gno.land/r/g1nqnrt3aldzhu6zzeg75yw97wvavqy7wr77g56q/deploy-test/v0/v0/admin"
9)
10
11const (
12 SetListLimitEvent = "SetListLimit"
13)
14
15var (
16 listLimit int = 100 // Max items per list query
17 migrationMigratorPkgPath string
18 migrationCompleted bool
19 migrationStateCleaned bool
20)
21
22// SetListLimit sets the max items per list query (admin only)
23func SetListLimit(cur realm, limit int) {
24 assertNotFrozen()
25 accesscontrol.AssertIsAdmin(0, cur, admin.IsAdmin)
26 if limit < 1 {
27 panic("limit must be at least 1")
28 }
29
30 oldLimit := listLimit
31 listLimit = limit
32
33 chain.Emit(
34 SetListLimitEvent,
35 "oldLimit", strconv.Itoa(oldLimit),
36 "newLimit", strconv.Itoa(limit),
37 )
38}
39
40// GetListLimit returns the max items per list query
41func GetListLimit() int {
42 return listLimit
43}