feat(账号到期): 普通账号不再带自己的到期时间,入口与接口一起收窄
口径(2026-10-05 用户定):到期时间只需要设在管理员/公司超管身上,普通账号的停用 由上级级联决定(组长 + 创建人 + 本公司公司超管,见 AccountExpiryService)。 此前这条只存在于约定里,任何调用方都能给普通账号写 expires_at。 - 后端 AdminUserService:建号/编辑两道 400(绕过界面直接打接口传值就拒), 把管理员改成普通账号时同批把 expires_at 置 null;判据 mayCarryOwnExpiry = admin|company_super_admin。 - 前端:user-create-model 导出同名判据(一支跨端用例逐字钉两端集合相等), toCreateUserRequest 对 normal 不下发;toEditUserUpdateRequest 按"改完之后 的角色"决定,不能带就发空串=清空,公司超管目标因请求不带 role 而保留原值; 两个对话框的「到期时间」项加 v-if="expiryEditable"。 - 用例:后端新增 4 支(含一条「普通账号仍可传空串清除」控制组,14 例绿); 前端新增 9 支;旧 company-user-create 那条编码旧口径的断言改 role=admin。
This commit is contained in:
@@ -63,9 +63,11 @@ test('请求体:admin/normal 一律不带 companyId;公司超管必须带且
|
||||
'没选公司就不许带(校验层会先拦住,这里兜底不静默)')
|
||||
})
|
||||
|
||||
test('到期时间:空串不下发,有值随请求体走', () => {
|
||||
test('到期时间:空串不下发,管理员有值随请求体走', () => {
|
||||
assert.equal('expiresAt' in toCreateUserRequest(form()), false, '留空 = 永不过期,不下发')
|
||||
assert.equal(toCreateUserRequest(form({ expiresAt: '2026-12-31 23:59:59' })).expiresAt,
|
||||
// 2026-10-05 收窄后到期时间只能设在管理员/公司超管身上(普通账号那条见
|
||||
// normal-account-no-own-expiry.test.ts),所以这条要角色=管理员才成立。
|
||||
assert.equal(toCreateUserRequest(form({ role: 'admin', expiresAt: '2026-12-31 23:59:59' })).expiresAt,
|
||||
'2026-12-31 23:59:59')
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user