teal-src/util/roles.d.tl
author Matthew Wild <mwild1@gmail.com>
Thu, 13 Oct 2022 09:55:36 +0100
changeset 12775 e9fcc69ea508
parent 12665 1c391c17a907
permissions -rw-r--r--
util.cache: Add some missing test cases Found via mutation testing.

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