补齐源快照、资料预演、正式导入及工资核算的依赖链路。 新增版本化输入、逐段 FIFO、生成锁和结构化当月调整, 并提供默认关闭的周期采集、有限重试及 Windows 托管。 原始客户资料、私有配置及首页改动不纳入本次提交。 BREAKING CHANGE: 升级前需应用新增迁移,并通过 PAYROLL_MAKER_USER_ID 绑定实际工资制作人,否则业务只读。 旧单批次核算默认关闭;历史兼容需显式启用 PAYROLL_ALLOW_LEGACY_CALCULATION。生产启用和真实金额待验收。
17 lines
617 B
Python
17 lines
617 B
Python
"""工资操作按已绑定的账号身份授权,管理员和岗位角色不构成旁路。"""
|
|
|
|
from app.core.config import get_settings
|
|
from app.core.exceptions import ForbiddenError
|
|
|
|
|
|
def can_write_payroll(user) -> bool:
|
|
"""未绑定制作人时关闭业务写入;停用账号不能操作。"""
|
|
maker = get_settings().payroll_maker_user_id
|
|
return maker is not None and user is not None and user.id == maker and user.status == 1
|
|
|
|
|
|
def ensure_payroll_writer(user):
|
|
if not can_write_payroll(user):
|
|
raise ForbiddenError("仅指定的工资制作人可以修改业务数据")
|
|
return user
|