fix(admin,api): isort and black
parent
4d003acb3e
commit
71489239d6
|
@ -0,0 +1,8 @@
|
||||||
|
[settings]
|
||||||
|
multi_line_output = 3
|
||||||
|
include_trailing_comma = True
|
||||||
|
force_grid_wrap = 0
|
||||||
|
use_parentheses = True
|
||||||
|
ensure_newline_before_comments = True
|
||||||
|
line_length = 88
|
||||||
|
|
|
@ -32,7 +32,14 @@ import secrets
|
||||||
|
|
||||||
from .events import Events
|
from .events import Events
|
||||||
from .exceptions import UserExists, UserNotFound
|
from .exceptions import UserExists, UserNotFound
|
||||||
from .helpers import count_repeated, rand_password, kpath2gids, kpath2kpaths, get_kid_from_kpath, get_group_with_childs
|
from .helpers import (
|
||||||
|
count_repeated,
|
||||||
|
get_group_with_childs,
|
||||||
|
get_kid_from_kpath,
|
||||||
|
kpath2gids,
|
||||||
|
kpath2kpaths,
|
||||||
|
rand_password,
|
||||||
|
)
|
||||||
|
|
||||||
MANAGER = os.environ["CUSTOM_ROLE_MANAGER"]
|
MANAGER = os.environ["CUSTOM_ROLE_MANAGER"]
|
||||||
TEACHER = os.environ["CUSTOM_ROLE_TEACHER"]
|
TEACHER = os.environ["CUSTOM_ROLE_TEACHER"]
|
||||||
|
@ -580,7 +587,8 @@ class Admin:
|
||||||
+ u["username"]
|
+ u["username"]
|
||||||
)
|
)
|
||||||
user_groups = [g.strip() for g in u["groups"].split(",") if g != ""]
|
user_groups = [g.strip() for g in u["groups"].split(",") if g != ""]
|
||||||
if not len(user_groups): user_groups = ["/"+u["role"].strip()]
|
if not len(user_groups):
|
||||||
|
user_groups = ["/" + u["role"].strip()]
|
||||||
pathslist = []
|
pathslist = []
|
||||||
for group in user_groups:
|
for group in user_groups:
|
||||||
pathpart = ""
|
pathpart = ""
|
||||||
|
@ -604,7 +612,8 @@ class Admin:
|
||||||
u["quota"] = "none"
|
u["quota"] = "none"
|
||||||
if u["role"] == "admin":
|
if u["role"] == "admin":
|
||||||
u["quota"] = "none"
|
u["quota"] = "none"
|
||||||
if u["quota"].lower() in ["false","unlimited"]: u["quota"] = "none"
|
if u["quota"].lower() in ["false", "unlimited"]:
|
||||||
|
u["quota"] = "none"
|
||||||
|
|
||||||
users.append(
|
users.append(
|
||||||
{
|
{
|
||||||
|
@ -846,7 +855,6 @@ class Admin:
|
||||||
)
|
)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
|
|
||||||
def sync_to_moodle_external(self): # works from the internal (keycloak)
|
def sync_to_moodle_external(self): # works from the internal (keycloak)
|
||||||
### Process all groups from the users keycloak_groups key
|
### Process all groups from the users keycloak_groups key
|
||||||
groups = []
|
groups = []
|
||||||
|
@ -967,7 +975,11 @@ class Admin:
|
||||||
u["first"] + " " + u["last"],
|
u["first"] + " " + u["last"],
|
||||||
)
|
)
|
||||||
except ProviderItemExists:
|
except ProviderItemExists:
|
||||||
log.warning(" NEXTCLOUD USERS: User " + u["username"] + " already exists. Skipping...")
|
log.warning(
|
||||||
|
" NEXTCLOUD USERS: User "
|
||||||
|
+ u["username"]
|
||||||
|
+ " already exists. Skipping..."
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
except:
|
except:
|
||||||
log.error(traceback.format_exc())
|
log.error(traceback.format_exc())
|
||||||
|
@ -995,7 +1007,9 @@ class Admin:
|
||||||
self.moodle.add_system_cohort(pathpart)
|
self.moodle.add_system_cohort(pathpart)
|
||||||
except:
|
except:
|
||||||
# print(traceback.format_exc())
|
# print(traceback.format_exc())
|
||||||
log.warning("MOODLE: Group " + pathpart + " probably already exists.")
|
log.warning(
|
||||||
|
"MOODLE: Group " + pathpart + " probably already exists."
|
||||||
|
)
|
||||||
|
|
||||||
### Get all existing moodle cohorts
|
### Get all existing moodle cohorts
|
||||||
cohorts = self.moodle.get_cohorts()
|
cohorts = self.moodle.get_cohorts()
|
||||||
|
@ -1093,7 +1107,9 @@ class Admin:
|
||||||
subpath = subpath + "/" + parts[i]
|
subpath = subpath + "/" + parts[i]
|
||||||
self.nextcloud.add_group(subpath)
|
self.nextcloud.add_group(subpath)
|
||||||
except:
|
except:
|
||||||
log.warning("NEXTCLOUD GROUPS: "+subpath+" probably already exists")
|
log.warning(
|
||||||
|
"NEXTCLOUD GROUPS: " + subpath + " probably already exists"
|
||||||
|
)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
ev = Events(
|
ev = Events(
|
||||||
|
@ -1629,7 +1645,9 @@ class Admin:
|
||||||
)
|
)
|
||||||
ev.increment({"name": "Added to nextcloud", "data": []})
|
ev.increment({"name": "Added to nextcloud", "data": []})
|
||||||
except ProviderItemExists:
|
except ProviderItemExists:
|
||||||
log.warning(" NEXTCLOUD USERS: User " + username + " already exists. Skipping...")
|
log.warning(
|
||||||
|
" NEXTCLOUD USERS: User " + username + " already exists. Skipping..."
|
||||||
|
)
|
||||||
except:
|
except:
|
||||||
log.error(traceback.format_exc())
|
log.error(traceback.format_exc())
|
||||||
|
|
||||||
|
@ -1819,7 +1837,11 @@ class Admin:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
ev.update_text("Error deleting group. Not found in keycloak!")
|
ev.update_text("Error deleting group. Not found in keycloak!")
|
||||||
log.error(' KEYCLOAK GROUPS: Could not delete group '+str(group_id)+' as it does not exist!')
|
log.error(
|
||||||
|
" KEYCLOAK GROUPS: Could not delete group "
|
||||||
|
+ str(group_id)
|
||||||
|
+ " as it does not exist!"
|
||||||
|
)
|
||||||
|
|
||||||
# {'id': '966ad67c-499a-4f56-bd1d-283691cde0e7', 'name': 'asdgfewfwe', 'path': '/asdgfewfwe', 'attributes': {}, 'realmRoles': [], 'clientRoles': {}, 'subGroups': [], 'access': {'view': True, 'manage': True, 'manageMembership': True}}
|
# {'id': '966ad67c-499a-4f56-bd1d-283691cde0e7', 'name': 'asdgfewfwe', 'path': '/asdgfewfwe', 'attributes': {}, 'realmRoles': [], 'clientRoles': {}, 'subGroups': [], 'access': {'view': True, 'manage': True, 'manageMembership': True}}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
import logging as log
|
import logging as log
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
import traceback
|
import traceback
|
||||||
|
from io import BytesIO
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
import os, shutil
|
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from schema import And, Optional, Schema, SchemaError, Use
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from io import BytesIO
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
from schema import And, Optional, Schema, SchemaError, Use
|
||||||
|
|
||||||
from admin import app
|
from admin import app
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import string
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
|
|
||||||
def get_recursive_groups(l_groups, l):
|
def get_recursive_groups(l_groups, l):
|
||||||
for d_group in l_groups:
|
for d_group in l_groups:
|
||||||
data = {}
|
data = {}
|
||||||
|
@ -14,6 +15,7 @@ def get_recursive_groups(l_groups, l):
|
||||||
l.append(data)
|
l.append(data)
|
||||||
return l
|
return l
|
||||||
|
|
||||||
|
|
||||||
def get_group_with_childs(keycloak_group):
|
def get_group_with_childs(keycloak_group):
|
||||||
return [g["path"] for g in get_recursive_groups([keycloak_group], [])]
|
return [g["path"] for g in get_recursive_groups([keycloak_group], [])]
|
||||||
|
|
||||||
|
@ -25,19 +27,29 @@ def system_username(username):
|
||||||
else False
|
else False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def system_group(groupname):
|
def system_group(groupname):
|
||||||
return True if groupname in ["admin", "manager", "teacher", "student"] else False
|
return True if groupname in ["admin", "manager", "teacher", "student"] else False
|
||||||
|
|
||||||
|
|
||||||
def get_group_from_group_id(group_id, groups):
|
def get_group_from_group_id(group_id, groups):
|
||||||
return next((d for d in groups if d.get("id") == group_id), None)
|
return next((d for d in groups if d.get("id") == group_id), None)
|
||||||
|
|
||||||
|
|
||||||
def get_kid_from_kpath(kpath, groups):
|
def get_kid_from_kpath(kpath, groups):
|
||||||
ids = [g["id"] for g in groups if g["path"] == kpath]
|
ids = [g["id"] for g in groups if g["path"] == kpath]
|
||||||
if not len(ids) or len(ids) > 1: return False
|
if not len(ids) or len(ids) > 1:
|
||||||
|
return False
|
||||||
return ids[0]
|
return ids[0]
|
||||||
|
|
||||||
|
|
||||||
def get_gid_from_kgroup_id(kgroup_id, groups):
|
def get_gid_from_kgroup_id(kgroup_id, groups):
|
||||||
return [g["path"].replace("/", ".")[1:] if len(g["path"].split("/")) else g["path"][1:] for g in groups if g["id"] == kgroup_id][0]
|
return [
|
||||||
|
g["path"].replace("/", ".")[1:] if len(g["path"].split("/")) else g["path"][1:]
|
||||||
|
for g in groups
|
||||||
|
if g["id"] == kgroup_id
|
||||||
|
][0]
|
||||||
|
|
||||||
|
|
||||||
def get_gids_from_kgroup_ids(kgroup_ids, groups):
|
def get_gids_from_kgroup_ids(kgroup_ids, groups):
|
||||||
return [get_gid_from_kgroup_id(kgroup_id, groups) for kgroup_id in kgroup_ids]
|
return [get_gid_from_kgroup_id(kgroup_id, groups) for kgroup_id in kgroup_ids]
|
||||||
|
@ -49,6 +61,7 @@ def kpath2gid(path):
|
||||||
return path.replace("/", ".")[1:]
|
return path.replace("/", ".")[1:]
|
||||||
return path.replace("/", ".")
|
return path.replace("/", ".")
|
||||||
|
|
||||||
|
|
||||||
def kpath2gids(path):
|
def kpath2gids(path):
|
||||||
path = kpath2gid(path)
|
path = kpath2gid(path)
|
||||||
l = []
|
l = []
|
||||||
|
@ -56,12 +69,14 @@ def kpath2gids(path):
|
||||||
l.append(".".join(path.split(".")[: i + 1]))
|
l.append(".".join(path.split(".")[: i + 1]))
|
||||||
return l
|
return l
|
||||||
|
|
||||||
|
|
||||||
def kpath2kpaths(path):
|
def kpath2kpaths(path):
|
||||||
l = []
|
l = []
|
||||||
for i in range(len(path.split("/"))):
|
for i in range(len(path.split("/"))):
|
||||||
l.append("/".join(path.split("/")[: i + 1]))
|
l.append("/".join(path.split("/")[: i + 1]))
|
||||||
return l[1:]
|
return l[1:]
|
||||||
|
|
||||||
|
|
||||||
def gid2kpath(gid):
|
def gid2kpath(gid):
|
||||||
return "/" + gid.replace(".", "/")
|
return "/" + gid.replace(".", "/")
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,12 @@ from pprint import pprint
|
||||||
import yaml
|
import yaml
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
from keycloak import KeycloakAdmin
|
from keycloak import KeycloakAdmin
|
||||||
from .helpers import kpath2kpaths, get_recursive_groups
|
|
||||||
|
from .helpers import get_recursive_groups, kpath2kpaths
|
||||||
|
from .postgres import Postgres
|
||||||
|
|
||||||
# from admin import app
|
# from admin import app
|
||||||
|
|
||||||
from .postgres import Postgres
|
|
||||||
|
|
||||||
|
|
||||||
class KeycloakClient:
|
class KeycloakClient:
|
||||||
"""https://www.keycloak.org/docs-api/13.0/rest-api/index.html
|
"""https://www.keycloak.org/docs-api/13.0/rest-api/index.html
|
||||||
|
|
|
@ -26,12 +26,12 @@ threads = {"external": None}
|
||||||
|
|
||||||
from keycloak.exceptions import KeycloakGetError
|
from keycloak.exceptions import KeycloakGetError
|
||||||
|
|
||||||
|
from ..lib.dashboard import Dashboard
|
||||||
from ..lib.exceptions import UserExists, UserNotFound
|
from ..lib.exceptions import UserExists, UserNotFound
|
||||||
|
|
||||||
from ..lib.dashboard import Dashboard
|
|
||||||
|
|
||||||
dashboard = Dashboard()
|
dashboard = Dashboard()
|
||||||
|
|
||||||
|
|
||||||
@app.route("/sysadmin/api/resync")
|
@app.route("/sysadmin/api/resync")
|
||||||
@app.route("/api/resync")
|
@app.route("/api/resync")
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -510,13 +510,18 @@ def dashboard_put(item):
|
||||||
{"Content-Type": "application/json"},
|
{"Content-Type": "application/json"},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/api/legal/<item>", methods=["GET", "POST"])
|
@app.route("/api/legal/<item>", methods=["GET", "POST"])
|
||||||
# @login_required
|
# @login_required
|
||||||
def legal_put(item):
|
def legal_put(item):
|
||||||
if request.method == "GET":
|
if request.method == "GET":
|
||||||
if item == "legal":
|
if item == "legal":
|
||||||
lang = request.args.get("lang")
|
lang = request.args.get("lang")
|
||||||
return json.dumps({ "html": "<b>Legal</b><br>This works! in lang: "+lang}), 200, {'Content-Type': 'application/json'}
|
return (
|
||||||
|
json.dumps({"html": "<b>Legal</b><br>This works! in lang: " + lang}),
|
||||||
|
200,
|
||||||
|
{"Content-Type": "application/json"},
|
||||||
|
)
|
||||||
# if item == "privacy":
|
# if item == "privacy":
|
||||||
# return json.dumps({ "html": "<b>Privacy policy</b><br>This works!"}), 200, {'Content-Type': 'application/json'}
|
# return json.dumps({ "html": "<b>Privacy policy</b><br>This works!"}), 200, {'Content-Type': 'application/json'}
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
|
@ -528,7 +533,7 @@ def legal_put(item):
|
||||||
lang = data["lang"]
|
lang = data["lang"]
|
||||||
except:
|
except:
|
||||||
log.error(traceback.format_exc())
|
log.error(traceback.format_exc())
|
||||||
return json.dumps(data), 200, {'Content-Type': 'application/json'}
|
return json.dumps(data), 200, {"Content-Type": "application/json"}
|
||||||
# if item == "privacy":
|
# if item == "privacy":
|
||||||
# data = None
|
# data = None
|
||||||
# try:
|
# try:
|
||||||
|
|
|
@ -10,6 +10,7 @@ import traceback
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
|
import requests
|
||||||
from flask import (
|
from flask import (
|
||||||
Response,
|
Response,
|
||||||
jsonify,
|
jsonify,
|
||||||
|
@ -26,8 +27,6 @@ from admin import app
|
||||||
from ..lib.avatars import Avatars
|
from ..lib.avatars import Avatars
|
||||||
from .decorators import is_admin
|
from .decorators import is_admin
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
avatars = Avatars()
|
avatars = Avatars()
|
||||||
|
|
||||||
""" OIDC TESTS """
|
""" OIDC TESTS """
|
||||||
|
@ -93,6 +92,7 @@ def dashboard(provider=False):
|
||||||
"pages/dashboard.html", title="Customization", nav="Customization", data=data
|
"pages/dashboard.html", title="Customization", nav="Customization", data=data
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/legal")
|
@app.route("/legal")
|
||||||
@login_required
|
@login_required
|
||||||
def legal():
|
def legal():
|
||||||
|
|
|
@ -12,7 +12,6 @@ from datetime import datetime, timedelta
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from admin.lib.keycloak_client import KeycloakClient
|
from admin.lib.keycloak_client import KeycloakClient
|
||||||
from admin.lib.postgres import Postgres
|
from admin.lib.postgres import Postgres
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
import json
|
import json
|
||||||
from lib.keycloak_client import KeycloakClient
|
|
||||||
import logging as log
|
import logging as log
|
||||||
|
|
||||||
|
from lib.keycloak_client import KeycloakClient
|
||||||
|
|
||||||
|
|
||||||
class KeycloakConfig:
|
class KeycloakConfig:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
@ -12,10 +12,10 @@ import yaml
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
from keycloak import KeycloakAdmin
|
from keycloak import KeycloakAdmin
|
||||||
|
|
||||||
# from admin import app
|
|
||||||
|
|
||||||
from .postgres import Postgres
|
from .postgres import Postgres
|
||||||
|
|
||||||
|
# from admin import app
|
||||||
|
|
||||||
|
|
||||||
class KeycloakClient:
|
class KeycloakClient:
|
||||||
"""https://www.keycloak.org/docs-api/13.0/rest-api/index.html
|
"""https://www.keycloak.org/docs-api/13.0/rest-api/index.html
|
||||||
|
|
|
@ -12,7 +12,6 @@ from datetime import datetime, timedelta
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from lib.keycloak_client import KeycloakClient
|
from lib.keycloak_client import KeycloakClient
|
||||||
from lib.postgres import Postgres
|
from lib.postgres import Postgres
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ from datetime import datetime, timedelta
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from lib.keycloak_client import KeycloakClient
|
from lib.keycloak_client import KeycloakClient
|
||||||
from lib.postgres import Postgres
|
from lib.postgres import Postgres
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ from datetime import datetime, timedelta
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from lib.keycloak_client import KeycloakClient
|
from lib.keycloak_client import KeycloakClient
|
||||||
from lib.mysql import Mysql
|
from lib.mysql import Mysql
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ from keycloak import KeycloakAdmin
|
||||||
from minio import Minio
|
from minio import Minio
|
||||||
from minio.commonconfig import REPLACE, CopySource
|
from minio.commonconfig import REPLACE, CopySource
|
||||||
from minio.deleteobjects import DeleteObject
|
from minio.deleteobjects import DeleteObject
|
||||||
|
|
||||||
from postgres import Postgres
|
from postgres import Postgres
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import diceware
|
||||||
import yaml
|
import yaml
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
from keycloak import KeycloakAdmin
|
from keycloak import KeycloakAdmin
|
||||||
|
|
||||||
from postgres import Postgres
|
from postgres import Postgres
|
||||||
|
|
||||||
options = diceware.handle_options(None)
|
options = diceware.handle_options(None)
|
||||||
|
|
|
@ -10,7 +10,6 @@ from pprint import pprint
|
||||||
import yaml
|
import yaml
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
from keycloak import KeycloakAdmin
|
from keycloak import KeycloakAdmin
|
||||||
|
|
||||||
from postgres import Postgres
|
from postgres import Postgres
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ from pprint import pprint
|
||||||
import yaml
|
import yaml
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
from keycloak import KeycloakAdmin
|
from keycloak import KeycloakAdmin
|
||||||
|
|
||||||
from postgres import Postgres
|
from postgres import Postgres
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ from datetime import datetime, timedelta
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from admin.lib.keycloak_client import KeycloakClient
|
from admin.lib.keycloak_client import KeycloakClient
|
||||||
from admin.lib.mysql import Mysql
|
from admin.lib.mysql import Mysql
|
||||||
|
|
||||||
|
|
|
@ -50,4 +50,4 @@ def send_templates(path):
|
||||||
"""
|
"""
|
||||||
Import all views
|
Import all views
|
||||||
"""
|
"""
|
||||||
from .views import AvatarsViews, MenuViews, InternalViews
|
from .views import AvatarsViews, InternalViews, MenuViews
|
||||||
|
|
|
@ -9,9 +9,8 @@ import traceback
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from keycloak import KeycloakAdmin
|
|
||||||
|
|
||||||
from api import app as application
|
from api import app as application
|
||||||
|
from keycloak import KeycloakAdmin
|
||||||
|
|
||||||
|
|
||||||
class Avatars:
|
class Avatars:
|
||||||
|
|
|
@ -12,9 +12,8 @@ import traceback
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from jinja2 import Environment, FileSystemLoader
|
|
||||||
|
|
||||||
from api import app as application
|
from api import app as application
|
||||||
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
|
||||||
|
|
||||||
def write_css():
|
def write_css():
|
||||||
|
@ -81,7 +80,9 @@ class Menu:
|
||||||
"https://api." + application.config["DOMAIN"] + custom["background_login"]
|
"https://api." + application.config["DOMAIN"] + custom["background_login"]
|
||||||
)
|
)
|
||||||
custom["logo"] = "https://api." + application.config["DOMAIN"] + custom["logo"]
|
custom["logo"] = "https://api." + application.config["DOMAIN"] + custom["logo"]
|
||||||
custom["product_logo"] = "https://api." + application.config["DOMAIN"] + custom["product_logo"]
|
custom["product_logo"] = (
|
||||||
|
"https://api." + application.config["DOMAIN"] + custom["product_logo"]
|
||||||
|
)
|
||||||
|
|
||||||
menudict = {**custom, **{"apps_internal": apps_internal, **user_menu_dict}}
|
menudict = {**custom, **{"apps_internal": apps_internal, **user_menu_dict}}
|
||||||
menudict["user"] = {}
|
menudict["user"] = {}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import time
|
||||||
import traceback
|
import traceback
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
|
from api import app
|
||||||
from flask import (
|
from flask import (
|
||||||
Response,
|
Response,
|
||||||
jsonify,
|
jsonify,
|
||||||
|
@ -18,8 +19,6 @@ from flask import (
|
||||||
url_for,
|
url_for,
|
||||||
)
|
)
|
||||||
|
|
||||||
from api import app
|
|
||||||
|
|
||||||
from ..lib.avatars import Avatars
|
from ..lib.avatars import Avatars
|
||||||
|
|
||||||
avatars = Avatars()
|
avatars = Avatars()
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from api import app
|
||||||
from flask import Response, jsonify, redirect, render_template, request, url_for
|
from flask import Response, jsonify, redirect, render_template, request, url_for
|
||||||
|
|
||||||
from .decorators import is_internal
|
from .decorators import is_internal
|
||||||
|
|
||||||
from api import app
|
|
||||||
|
|
||||||
@app.route("/restart", methods=["GET"])
|
@app.route("/restart", methods=["GET"])
|
||||||
@is_internal
|
@is_internal
|
||||||
|
|
|
@ -8,9 +8,8 @@ import time
|
||||||
import traceback
|
import traceback
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from flask import Response, jsonify, redirect, render_template, request, url_for
|
|
||||||
|
|
||||||
from api import app
|
from api import app
|
||||||
|
from flask import Response, jsonify, redirect, render_template, request, url_for
|
||||||
|
|
||||||
from ..lib.menu import Menu
|
from ..lib.menu import Menu
|
||||||
|
|
||||||
|
@ -36,6 +35,7 @@ def api_v2_header(format, application=False):
|
||||||
if application == "wordpress":
|
if application == "wordpress":
|
||||||
return render_template("header_wordpress.html")
|
return render_template("header_wordpress.html")
|
||||||
|
|
||||||
|
|
||||||
# @app.route('/user_menu/<format>', methods=['GET'])
|
# @app.route('/user_menu/<format>', methods=['GET'])
|
||||||
# @app.route('/user_menu/<format>/<application>', methods=['GET'])
|
# @app.route('/user_menu/<format>/<application>', methods=['GET'])
|
||||||
# def api_v2_user_menu(format,application=False):
|
# def api_v2_user_menu(format,application=False):
|
||||||
|
|
|
@ -6,6 +6,7 @@ from functools import wraps
|
||||||
|
|
||||||
from flask import redirect, request, url_for
|
from flask import redirect, request, url_for
|
||||||
|
|
||||||
|
|
||||||
def is_internal(fn):
|
def is_internal(fn):
|
||||||
@wraps(fn)
|
@wraps(fn)
|
||||||
def decorated_view(*args, **kwargs):
|
def decorated_view(*args, **kwargs):
|
||||||
|
|
|
@ -4,9 +4,8 @@ from eventlet import monkey_patch
|
||||||
|
|
||||||
monkey_patch()
|
monkey_patch()
|
||||||
|
|
||||||
from flask_socketio import SocketIO
|
|
||||||
|
|
||||||
from api import app
|
from api import app
|
||||||
|
from flask_socketio import SocketIO
|
||||||
|
|
||||||
socketio = SocketIO(app)
|
socketio = SocketIO(app)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import json, sys
|
import json
|
||||||
|
import sys
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
from keycloak import KeycloakAdmin
|
from keycloak import KeycloakAdmin
|
||||||
|
|
Loading…
Reference in New Issue