← Back to Realms

Realm

gno.land/r/akkadia/beta/user

Overview

Realm Path
gno.land/r/akkadia/beta/user
Exported Functions
14
State Entries
10
Source Files
7
Total Package Entries
37

Exported Functions

14 exported functions

State

10 state entries

Source Code

FILES
config.gno
go
1package user
2
3import (
4	"chain"
5	"strconv"
6
7	"gno.land/p/akkadia/beta/accesscontrol"
8	"gno.land/r/akkadia/beta/admin"
9)
10
11const (
12	SetListLimitEvent = "SetListLimit"
13	SetFrozenEvent    = "SetFrozen"
14)
15
16var (
17	listLimit int = 100 // Max items per list query
18	isFrozen      = true
19)
20
21func SetListLimit(cur realm, limit int) {
22	accesscontrol.AssertIsAdmin(0, cur, admin.IsAdmin)
23	if limit < 1 {
24		panic("limit must be at least 1")
25	}
26
27	oldLimit := listLimit
28	listLimit = limit
29
30	chain.Emit(
31		SetListLimitEvent,
32		"oldLimit", strconv.Itoa(oldLimit),
33		"newLimit", strconv.Itoa(limit),
34	)
35}
36
37func GetListLimit() int {
38	return listLimit
39}
40
41// SetFrozen controls direct user creation and deletion only.
42func SetFrozen(cur realm, frozen bool) {
43	accesscontrol.AssertIsAdmin(0, cur, admin.IsAdmin)
44	oldFrozen := isFrozen
45	isFrozen = frozen
46	chain.Emit(
47		SetFrozenEvent,
48		"oldFrozen", strconv.FormatBool(oldFrozen),
49		"newFrozen", strconv.FormatBool(frozen),
50	)
51}
52

Raw Package Data

Raw JSON data