按业务模块拆分附件权限

This commit is contained in:
Cheng Zhou
2026-05-28 10:53:00 +08:00
parent d2b41ae454
commit 31fcb7e6f2
7 changed files with 473 additions and 57 deletions
@@ -0,0 +1,25 @@
export type AttachmentPermissionAction = "create" | "read" | "delete";
const ATTACHMENT_PERMISSION_PREFIXES: Record<string, string> = {
contract_fee_contract: "fees_contracts_attachments",
contract_fee_voucher: "fees_contracts_attachments",
contract_fee_invoice: "fees_contracts_attachments",
startup_feasibility: "startup_initiation_attachments",
startup_ethics: "startup_ethics_attachments",
startup_kickoff: "startup_auth_attachments",
startup_kickoff_minutes: "startup_auth_attachments",
startup_kickoff_signin: "startup_auth_attachments",
startup_kickoff_ppt: "startup_auth_attachments",
training_authorization: "startup_auth_attachments",
drug_shipment: "drug_shipments_attachments",
precaution: "precautions_attachments",
faq_replies: "faq_attachments",
};
export const getAttachmentPermissionKey = (
entityType: string,
action: AttachmentPermissionAction
): string | null => {
const prefix = ATTACHMENT_PERMISSION_PREFIXES[entityType];
return prefix ? `${prefix}:${action}` : null;
};