authsquare/app/modules/dashboard/users.py

48 lines
1.9 KiB
Python
Raw Permalink Normal View History

2024-09-26 12:16:45 +07:00
from mako.template import Template
from config import globalvar
from scripts import loggorilla
import procedure.validation as procedure_validation
class users:
def __init__(self):
pass
def html(self, params):
APIADDR = "/dashboard/users"
loggorilla.prcss(APIADDR, "Define page parameters")
active_page = "Users"
allowed_roles = [1,2]
loggorilla.prcss(APIADDR, "Account validation")
user_validation = procedure_validation.validation().account(APIADDR, allowed_roles)
user = user_validation['data']
return Template(params["mako"]["website"]['index']).render(
title = globalvar.title,
navbar = Template(params["mako"]["website"]['navbar']).render(
title = globalvar.title,
menu = globalvar.menu['dashboard']['navbar'],
profile = {
"picture" : "https://ditaajipratama.net/img/no-profile-donut.png",
"name" : user['profile']['username'],
"menu" : globalvar.menu['dashboard']['profile']
},
user_roles = user['profile']['roles'],
active_page = active_page
),
sidebar = Template(params["mako"]["website"]['sidebar']).render(
menu = globalvar.menu['dashboard']['sidebar'],
user_roles = user['profile']['roles'],
active_page = active_page
),
footer = Template(params["mako"]["website"]['footer']).render(
copyright = globalvar.copyright,
),
container = Template(params["mako"]["website"]['container']).render(
token = user['token']
)
)