aboutsummaryrefslogtreecommitdiffstats
path: root/teal-src/prosody/util/roles.d.tl
blob: fef4f88a5d14ce554a16f8e75ce6597ea81ece5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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