feat: 实现克隆租户角色接口

- POST /api/admin/v1/tenants/{tenantId}/roles/{roleId}/clone
- 支持复制角色基本信息和权限

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-30 08:25:12 +00:00
parent 764661f9e3
commit 395ac4da05
3 changed files with 153 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
using MediatR;
using TakeoutSaaS.Application.Identity.Contracts;
namespace TakeoutSaaS.Application.Identity.Commands;
/// <summary>
/// 克隆租户角色命令。
/// </summary>
public sealed record CloneTenantRoleCommand : IRequest<RoleDto>
{
/// <summary>
/// 租户 ID由路由绑定
/// </summary>
public long TenantId { get; init; }
/// <summary>
/// 源角色 ID由路由绑定
/// </summary>
public long SourceRoleId { get; init; }
/// <summary>
/// 新角色编码(租户内唯一)。
/// </summary>
public string NewCode { get; init; } = string.Empty;
/// <summary>
/// 新角色名称(为空则沿用源角色)。
/// </summary>
public string? Name { get; init; }
/// <summary>
/// 新角色描述(为空则沿用源角色)。
/// </summary>
public string? Description { get; init; }
/// <summary>
/// 是否复制权限(默认 true
/// </summary>
public bool CopyPermissions { get; init; } = true;
}