48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
from mako.template import Template
|
|
from config import globalvar, navigation
|
|
from scripts import loggorilla
|
|
|
|
import procedure.validation as procedure_validation
|
|
|
|
class users:
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
def html(self, params):
|
|
APIADDR = "/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']
|
|
|
|
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,
|
|
navbar = Template(params["mako"]["website"]['navbar']).render(
|
|
menu = navigation.menu['public']['navbar'],
|
|
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'],
|
|
allow = allow
|
|
)
|
|
)
|