From 029388ddc88933d9679c729c8270dada91020e13 Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Wed, 13 Aug 2025 08:26:05 +0700 Subject: [PATCH] Set the allowed roles for user on invitation --- modules/public/users.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/public/users.py b/modules/public/users.py index 51c6841..8a9356d 100644 --- a/modules/public/users.py +++ b/modules/public/users.py @@ -20,6 +20,15 @@ class users: user_validation = procedure_validation.validation().account(APIADDR, allowed_roles) user = user_validation['data'] + allowed_grant = globalvar.allowed_grant + allow = list({ + row + for role in user["profile"]["roles"] + for grant in allowed_grant + if grant["roles"] == role + for row in grant["allowed"] + }) + return Template(params["mako"]["website"]['index']).render( title = globalvar.title, header = globalvar.header, @@ -32,6 +41,7 @@ class users: copyright = globalvar.copyright, ), container = Template(params["mako"]["website"]['container']).render( - token = user['token'] + token = user['token'], + allow = allow ) )