Differences From
Artifact [2c2e954f5c]:
10 10 };
11 11 relation = lib.enum {
12 12 'follow', 'mute', 'block'
13 13 };
14 14 credset = lib.set {
15 15 'pw', 'otp', 'challenge', 'trust'
16 16 };
17 + privset = lib.set {
18 + 'post', 'edit', 'acct', 'upload', 'censor', 'admin'
19 + }
17 20 }
18 21
19 22 local str = rawstring --lib.mem.ptr(int8)
20 23
21 24 struct m.source
22 25
23 26 struct m.rights {
................................................................................
28 31 -- user powers -- default on
29 32 login: bool
30 33 visible: bool
31 34 post: bool
32 35 shout: bool
33 36 propagate: bool
34 37 upload: bool
38 + acct: bool
39 + edit: bool
35 40
36 41 -- admin powers -- default off
37 42 ban: bool
38 43 config: bool
39 44 censor: bool
40 45 suspend: bool
41 46 rebrand: bool -- modify site's brand identity
................................................................................
140 145 end
141 146
142 147 struct m.auth {
143 148 aid: uint64
144 149 uid: uint64
145 150 aname: str
146 151 netmask: m.inet
147 - restrict: lib.mem.ptr(rawstring)
152 + privs: m.privset
148 153 blacklist: bool
149 154 }
150 -
151 155
152 156 -- backends only handle content on the local server
153 157 struct m.backend { id: rawstring
154 158 open: &m.source -> &opaque
155 159 close: &m.source -> {}
156 160
157 161 conf_get: {&m.source, rawstring} -> lib.mem.ptr(int8)
158 162 conf_set: {&m.source, rawstring, rawstring} -> {}
159 163 conf_reset: {&m.source, rawstring} -> {}
160 164
161 165 actor_save: {&m.source, m.actor} -> bool
162 166 actor_create: {&m.source, m.actor} -> bool
163 - actor_fetch_xid: {&m.source, rawstring} -> lib.mem.ptr(m.actor)
167 + actor_fetch_xid: {&m.source, lib.mem.ptr(int8)} -> lib.mem.ptr(m.actor)
164 168 actor_fetch_uid: {&m.source, uint64} -> lib.mem.ptr(m.actor)
165 169 actor_notif_fetch_uid: {&m.source, uint64} -> lib.mem.ptr(m.notif)
166 170 actor_enum: {&m.source} -> lib.mem.ptr(&m.actor)
167 171 actor_enum_local: {&m.source} -> lib.mem.ptr(&m.actor)
168 172
169 173 actor_auth_how: {&m.source, m.inet, rawstring} -> m.credset
170 174 -- returns a set of auth method categories that are available for a
................................................................................
183 187 -- fingerprint: rawstring
184 188 actor_auth_api: {&m.source, m.inet, rawstring, rawstring} -> uint64
185 189 -- handles API authentication
186 190 -- origin: inet
187 191 -- handle: rawstring
188 192 -- key: rawstring (X-API-Key)
189 193 actor_auth_record_fetch: {&m.source, uint64} -> lib.mem.ptr(m.auth)
194 + actor_session_fetch: {&m.source, uint64, m.inet} -> {lib.stat(m.auth), lib.mem.ptr(m.actor)}
195 + -- retrieves an auth record + actor combo suitable by AID suitable
196 + -- for determining session validity & caps
197 + -- aid: uint64
198 + -- origin: inet
190 199
191 200 actor_conf_str: cnf(rawstring, lib.mem.ptr(int8))
192 201 actor_conf_int: cnf(intptr, lib.stat(intptr))
193 202
194 203 post_save: {&m.source, &m.post} -> bool
195 204 post_create: {&m.source, &m.post} -> bool
196 205 actor_post_fetch_uid: {&m.source, uint64, m.range} -> lib.mem.ptr(m.post)