Annotate

teal-src/util/roles.d.tl @ 12687:5b69ecaf3427

util.stanza: Add add_error() to simplify adding error tags to existing stanzas Some fiddling is required now in error_reply() to ensure the cursor is in the same place as before this change (a lot of code apparently uses that feature).
author Matthew Wild <mwild1@gmail.com>
date Mon, 29 Aug 2022 14:59:46 +0100
parent 12661:1c391c17a907
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12661
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
1 local record util_roles
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
2
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
3 type context = any
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
5 record Role
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
6 id : string
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
7 name : string
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
8 description : string
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
9 default : boolean
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
10 priority : number -- or integer?
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
11 permissions : { string : boolean }
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
12
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
13 may : function (Role, string, context)
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
14 clone : function (Role, role_config)
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
15 set_permission : function (Role, string, boolean, boolean)
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
16 end
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
17
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
18 is_role : function (any) : boolean
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
19
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
20 record role_config
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
21 name : string
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
22 description : string
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
23 default : boolean
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
24 priority : number -- or integer?
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
25 inherits : { Role }
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
26 permissions : { string : boolean }
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
27 end
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
28
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
29 new : function (role_config, Role) : Role
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
30 end
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
31
1c391c17a907 util.roles: Add Teal interface declaration
Kim Alvefur <zash@zash.se>
parents:
diff changeset
32 return util_roles