# HG changeset patch # User Kim Alvefur # Date 1660334949 -7200 # Node ID 1c391c17a907344a38633ec46473e8a1381685ed # Parent e8f57970ced5e7cdb33ab8f0e0f5fba020443584 util.roles: Add Teal interface declaration diff -r e8f57970ced5 -r 1c391c17a907 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