增加get_all_roles等后端api
This commit is contained in:
parent
06286401b7
commit
bea1c3306f
1
apps/jingrow/jingrow/core/pagetype/user/__init__.py
Normal file
1
apps/jingrow/jingrow/core/pagetype/user/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
# Core pagetype user package
|
||||
31
apps/jingrow/jingrow/core/pagetype/user/user.py
Normal file
31
apps/jingrow/jingrow/core/pagetype/user/user.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2025, JINGROW and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
"""
|
||||
User 相关白名单函数 - 转发到 SaaS 端
|
||||
"""
|
||||
|
||||
import jingrow
|
||||
import requests
|
||||
import logging
|
||||
from jingrow.config import Config
|
||||
from jingrow.utils.auth import get_request_session_cookie
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@jingrow.whitelist()
|
||||
def get_all_roles(**kwargs):
|
||||
"""获取所有角色 - 转发到 SaaS 端"""
|
||||
url = f"{Config.jingrow_server_url}/api/action/jingrow.core.pagetype.user.user.get_all_roles"
|
||||
headers = {"Accept": "application/json", "Content-Type": "application/json"}
|
||||
|
||||
session_cookie = get_request_session_cookie()
|
||||
if session_cookie:
|
||||
headers["Cookie"] = f"sid={session_cookie}"
|
||||
|
||||
resp = requests.post(url, headers=headers, json=kwargs, timeout=30)
|
||||
if resp.status_code == 200:
|
||||
return resp.json().get("message", [])
|
||||
logger.error(f"[user.get_all_roles] SaaS error: {resp.status_code}")
|
||||
return []
|
||||
1
apps/jingrow/jingrow/desk/__init__.py
Normal file
1
apps/jingrow/jingrow/desk/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
# Desk package
|
||||
1
apps/jingrow/jingrow/desk/form/__init__.py
Normal file
1
apps/jingrow/jingrow/desk/form/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
# Desk form package
|
||||
31
apps/jingrow/jingrow/desk/form/load.py
Normal file
31
apps/jingrow/jingrow/desk/form/load.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2025, JINGROW and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
"""
|
||||
Form load 相关白名单函数 - 转发到 SaaS 端
|
||||
"""
|
||||
|
||||
import jingrow
|
||||
import requests
|
||||
import logging
|
||||
from jingrow.config import Config
|
||||
from jingrow.utils.auth import get_request_session_cookie
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@jingrow.whitelist()
|
||||
def getdoc(**kwargs):
|
||||
"""获取文档 - 转发到 SaaS 端"""
|
||||
url = f"{Config.jingrow_server_url}/api/action/jingrow.desk.form.load.getdoc"
|
||||
headers = {"Accept": "application/json", "Content-Type": "application/json"}
|
||||
|
||||
session_cookie = get_request_session_cookie()
|
||||
if session_cookie:
|
||||
headers["Cookie"] = f"sid={session_cookie}"
|
||||
|
||||
resp = requests.post(url, headers=headers, json=kwargs, timeout=30)
|
||||
if resp.status_code == 200:
|
||||
return resp.json().get("message", {})
|
||||
logger.error(f"[form.load.getdoc] SaaS error: {resp.status_code}")
|
||||
return {}
|
||||
1
apps/jingrow/jingrow/desk/pagetype/__init__.py
Normal file
1
apps/jingrow/jingrow/desk/pagetype/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
# Desk pagetype package
|
||||
@ -0,0 +1 @@
|
||||
# Dashboard chart package
|
||||
@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2025, JINGROW and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
"""
|
||||
Dashboard Chart 相关白名单函数 - 转发到 SaaS 端
|
||||
"""
|
||||
|
||||
import jingrow
|
||||
import requests
|
||||
import logging
|
||||
from jingrow.config import Config
|
||||
from jingrow.utils.auth import get_request_session_cookie
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@jingrow.whitelist()
|
||||
def get(**kwargs):
|
||||
"""获取 Dashboard Chart - 转发到 SaaS 端"""
|
||||
url = f"{Config.jingrow_server_url}/api/action/jingrow.desk.pagetype.dashboard_chart.dashboard_chart.get"
|
||||
headers = {"Accept": "application/json", "Content-Type": "application/json"}
|
||||
|
||||
session_cookie = get_request_session_cookie()
|
||||
if session_cookie:
|
||||
headers["Cookie"] = f"sid={session_cookie}"
|
||||
|
||||
resp = requests.post(url, headers=headers, json=kwargs, timeout=30)
|
||||
if resp.status_code == 200:
|
||||
return resp.json().get("message", {})
|
||||
logger.error(f"[dashboard_chart.get] SaaS error: {resp.status_code}")
|
||||
return {}
|
||||
@ -0,0 +1 @@
|
||||
# Dashboard chart source package
|
||||
@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2025, JINGROW and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
"""
|
||||
Dashboard Chart Source 相关白名单函数 - 转发到 SaaS 端
|
||||
"""
|
||||
|
||||
import jingrow
|
||||
import requests
|
||||
import logging
|
||||
from jingrow.config import Config
|
||||
from jingrow.utils.auth import get_request_session_cookie
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@jingrow.whitelist()
|
||||
def get_config(**kwargs):
|
||||
"""获取 Chart Source 配置 - 转发到 SaaS 端"""
|
||||
url = f"{Config.jingrow_server_url}/api/action/jingrow.desk.pagetype.dashboard_chart_source.dashboard_chart_source.get_config"
|
||||
headers = {"Accept": "application/json", "Content-Type": "application/json"}
|
||||
|
||||
session_cookie = get_request_session_cookie()
|
||||
if session_cookie:
|
||||
headers["Cookie"] = f"sid={session_cookie}"
|
||||
|
||||
resp = requests.post(url, headers=headers, json=kwargs, timeout=30)
|
||||
if resp.status_code == 200:
|
||||
return resp.json().get("message", {})
|
||||
logger.error(f"[dashboard_chart_source.get_config] SaaS error: {resp.status_code}")
|
||||
return {}
|
||||
Loading…
x
Reference in New Issue
Block a user