File

teal-src/util/roles.d.tl @ 12782:8815d3090928

util.mathcompat: Module to ease reuse of math.type() Mostly to ensure it is available during tests, as util.startup is not invoked there
author Kim Alvefur <zash@zash.se>
date Thu, 20 Oct 2022 16:50:12 +0200
parent 12661:1c391c17a907
line wrap: on
line source

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