feat(security): complete capability messaging workflows

This commit is contained in:
2026-07-29 11:21:15 +08:00
parent df88fa19cb
commit 5c4de4b282
35 changed files with 19544 additions and 89 deletions

View File

@@ -0,0 +1,28 @@
using MassTransit;
using Tiku.Application.Jobs;
using Tiku.Application.Security;
using Tiku.Contracts;
namespace Tiku.Infrastructure.Messaging;
[ConsumerAuthorizationMetadata(
"tenant", "dynamic-job-module", CapabilityOperation.Write, "background_job.execute",
RequiresSystemScope = true)]
internal sealed class BackgroundJobRequestedConsumer(
IBackgroundJobService backgroundJobService,
ITenantContextInitializer tenantContextInitializer) : IConsumer<BackgroundJobRequestedV1>
{
public async Task Consume(ConsumeContext<BackgroundJobRequestedV1> context)
{
var message = context.Message;
tenantContextInitializer.InitializeSystem(
message.TenantId,
$"RabbitMQ background job {message.JobType}");
await backgroundJobService.ProcessRequestedAsync(
message.JobId,
message.TenantId,
message.JobType,
$"rabbitmq:{Environment.MachineName}",
context.CancellationToken);
}
}