feat(rbac): 注册开关 register_open 检查(appbase params 表,0=关闭注册)

This commit is contained in:
yumoqing 2026-08-21 19:19:16 +08:00
parent 77c17f6374
commit a0b200c459

View File

@ -100,6 +100,20 @@ async def create_user(sor, ns, roles=[]):
})
async def register_user(sor, ns):
# 注册开关检查appbase params 表 register_open1=开放0=关闭superuser 可在参数管理界面改
try:
pro = await sor.R('params', {'params_name': 'register_open'})
if pro and str(pro[0].params_value).strip() == '0':
return {
"status": "error",
"data": {
"message": "注册暂未开放,请联系管理员",
"user": None
}
}
except Exception as e:
debug(f'register_user: register_open check skipped: {e}')
if ns.password != ns.cfm_password:
debug('password not match')
return False