Compare commits
2 Commits
4db0b2c715
...
f066bdd960
| Author | SHA1 | Date | |
|---|---|---|---|
| f066bdd960 | |||
| 23aaf3dd0b |
40
models/appcodes.json
Normal file
40
models/appcodes.json
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"summary": [
|
||||||
|
{
|
||||||
|
"name": "appcodes",
|
||||||
|
"title": "应用编码表",
|
||||||
|
"primary": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"title": "id",
|
||||||
|
"type": "str",
|
||||||
|
"length": 32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"title": "编码名称",
|
||||||
|
"type": "str",
|
||||||
|
"length": 255
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "hierarchy_flg",
|
||||||
|
"title": "多级标志",
|
||||||
|
"type": "str",
|
||||||
|
"length": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"field": "hierarchy_flg",
|
||||||
|
"table": "appcodes_kv",
|
||||||
|
"valuefield": "k",
|
||||||
|
"textfield": "v",
|
||||||
|
"cond": "parentid='code_hierarchy'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
54
models/appcodes_kv.json
Normal file
54
models/appcodes_kv.json
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"summary": [
|
||||||
|
{
|
||||||
|
"name": "appcodes_kv",
|
||||||
|
"title": "编码键值表",
|
||||||
|
"primary": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"title": "id",
|
||||||
|
"type": "str",
|
||||||
|
"length": 32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "parentid",
|
||||||
|
"title": "父id",
|
||||||
|
"type": "str",
|
||||||
|
"length": 32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "k",
|
||||||
|
"title": "键",
|
||||||
|
"type": "str",
|
||||||
|
"length": 32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "v",
|
||||||
|
"title": "值",
|
||||||
|
"type": "str",
|
||||||
|
"length": 255
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"indexes": [
|
||||||
|
{
|
||||||
|
"name": "idx1",
|
||||||
|
"idxtype": "unique",
|
||||||
|
"idxfields": [
|
||||||
|
"parentid",
|
||||||
|
"k"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "idx2",
|
||||||
|
"idxtype": "index",
|
||||||
|
"idxfields": [
|
||||||
|
"parentid"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
31
models/params.json
Normal file
31
models/params.json
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"summary": [
|
||||||
|
{
|
||||||
|
"name": "params",
|
||||||
|
"title": "参数表",
|
||||||
|
"primary": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"title": "id",
|
||||||
|
"type": "str",
|
||||||
|
"length": 32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "params_name",
|
||||||
|
"title": "参数名称",
|
||||||
|
"type": "str",
|
||||||
|
"length": 255
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "params_value",
|
||||||
|
"title": "参数值",
|
||||||
|
"type": "str",
|
||||||
|
"length": 4000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
25
models/svgicon.json
Normal file
25
models/svgicon.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"summary": [
|
||||||
|
{
|
||||||
|
"name": "svgicon",
|
||||||
|
"title": "图标",
|
||||||
|
"primary": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"catelog": "entity"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"title": "id",
|
||||||
|
"type": "str",
|
||||||
|
"length": 32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "icon",
|
||||||
|
"title": "svg内容",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
32
scripts/load_path.py
Normal file
32
scripts/load_path.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
"""
|
||||||
|
appbase 模块 RBAC 权限注册脚本
|
||||||
|
执行方式: cd ~/repos/sage && ./py3/bin/python ../appbase/scripts/load_path.py
|
||||||
|
"""
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
|
||||||
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||||
|
|
||||||
|
from rbac.rbac import set_path_perm
|
||||||
|
|
||||||
|
PERMISSIONS = [
|
||||||
|
# appbase 主页面
|
||||||
|
{'path': '/appbase', 'permtype': 'logined', 'method': 'any'},
|
||||||
|
# UI 页面
|
||||||
|
{'path': '/appbase/menu.ui', 'permtype': 'logined', 'method': 'any'},
|
||||||
|
{'path': '/appbase/cron/index.ui', 'permtype': 'logined', 'method': 'any'},
|
||||||
|
# DSPY 接口
|
||||||
|
{'path': '/appbase/get_code.dspy', 'permtype': 'logined', 'method': 'any'},
|
||||||
|
{'path': '/appbase/get_appcodes_kv.dspy', 'permtype': 'logined', 'method': 'any'},
|
||||||
|
{'path': '/appbase/show_icon.dspy', 'permtype': 'logined', 'method': 'any'},
|
||||||
|
{'path': '/appbase/cron/switch_bizdate.dspy', 'permtype': 'logined', 'method': 'any'},
|
||||||
|
]
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
for perm in PERMISSIONS:
|
||||||
|
await set_path_perm(perm['path'], perm['permtype'], method=perm['method'])
|
||||||
|
print(f"OK: {perm['path']} -> {perm['permtype']}")
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import asyncio
|
||||||
|
asyncio.run(main())
|
||||||
Loading…
x
Reference in New Issue
Block a user