fix: preserve partial authorized snapshot projections
This commit is contained in:
1 parent
38fd3e90f9
commit
d903252807
1 file changed
+1
-1
@@ -4,7 +4,7 @@ const {checkTemplates}=require('./template-validation.cjs');
|
||||
async function orderRuleApi({orderRules,mail,workspace,user,route,method,body,reply,response}){
|
||||
if(route!=='/api/order-rules'&&!route.startsWith('/api/order-rules/'))return false;
|
||||
if(!orderRules)fail('分类通知规则服务未启动。',503);
|
||||
if(route==='/api/order-rules'&&method==='GET'){const snapshot=require('./access.cjs').publicSnapshot(orderRules,workspace,user);snapshot.rules=snapshot.rules.map(rule=>({huizhouEnabled:false,huizhouTemplateId:'',...rule}));reply(200,snapshot);return true;}
|
||||
if(route==='/api/order-rules'&&method==='GET'){const snapshot=require('./access.cjs').publicSnapshot(orderRules,workspace,user);if(Array.isArray(snapshot.rules))snapshot.rules=snapshot.rules.map(rule=>({huizhouEnabled:false,huizhouTemplateId:'',...rule}));reply(200,snapshot);return true;}
|
||||
if(route==='/api/order-rules/import-template'&&method==='GET'){
|
||||
if(user.role!=='admin')fail('仅管理员可导出规则配置。',403);
|
||||
const bytes=await require('./import-template.cjs').template(orderRules);response.writeHead(200,{'Content-Type':'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','Content-Disposition':"attachment; filename*=UTF-8''"+encodeURIComponent('分类规则.xlsx')});response.end(bytes);return true;
|
||||
|
||||
Reference in new issue
Block a user