util.roles: Add Teal interface declaration
authorKim Alvefur <zash@zash.se>
Fri, 12 Aug 2022 22:09:09 +0200
changeset 12665 1c391c17a907
parent 12664 e8f57970ced5
child 12666 07424992d7fc
util.roles: Add Teal interface declaration
teal-src/util/roles.d.tl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/teal-src/util/roles.d.tl	Fri Aug 12 22:09:09 2022 +0200
@@ -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