Changeset

12661:1c391c17a907

util.roles: Add Teal interface declaration
author Kim Alvefur <zash@zash.se>
date Fri, 12 Aug 2022 22:09:09 +0200
parents 12660:e8f57970ced5
children 12662:07424992d7fc
files teal-src/util/roles.d.tl
diffstat 1 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /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