aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-08-12 22:09:09 +0200
committerKim Alvefur <zash@zash.se>2022-08-12 22:09:09 +0200
commit2b0676396dc84dad48735a9e3782bb4f13b36471 (patch)
tree6a00bfdb4ff84c300ee320dabedd08a8a6fabcca
parent1fac00b2affd58bcfbe47347280a406eccefb805 (diff)
downloadprosody-2b0676396dc84dad48735a9e3782bb4f13b36471.tar.gz
prosody-2b0676396dc84dad48735a9e3782bb4f13b36471.zip
util.roles: Add Teal interface declaration
-rw-r--r--teal-src/util/roles.d.tl32
1 files changed, 32 insertions, 0 deletions
diff --git a/teal-src/util/roles.d.tl b/teal-src/util/roles.d.tl
new file mode 100644
index 00000000..fef4f88a
--- /dev/null
+++ b/teal-src/util/roles.d.tl
@@ -0,0 +1,32 @@
+local record util_roles
+
+ type context = any
+
+ record Role
+ id : string
+ name : string
+ description : string
+ default : boolean
+ priority : number -- or integer?
+ permissions : { string : boolean }
+
+ may : function (Role, string, context)
+ clone : function (Role, role_config)
+ set_permission : function (Role, string, boolean, boolean)
+ end
+
+ is_role : function (any) : boolean
+
+ record role_config
+ name : string
+ description : string
+ default : boolean
+ priority : number -- or integer?
+ inherits : { Role }
+ permissions : { string : boolean }
+ end
+
+ new : function (role_config, Role) : Role
+end
+
+return util_roles