Added admin override when updating organisation
This commit is contained in:
@@ -182,7 +182,7 @@ public sealed class GovernanceService(IDbContextFactory<ApplicationDbContext> co
|
||||
if (!await context.Users.AnyAsync(u => u.Id == request.OrganisationUser, cancellationToken))
|
||||
return Result.Fail(ValidationError.Create("Organisation user not found"));
|
||||
|
||||
if (!await context.TenantUsers.AnyAsync(u => u.UserId == request.OrganisationUser && u.TenantId == tenantContext.TenantId, cancellationToken))
|
||||
if (!tenantContext.IsAdmin && !await context.TenantUsers.AnyAsync(u => u.UserId == request.OrganisationUser && u.TenantId == tenantContext.TenantId, cancellationToken))
|
||||
return Result.Fail(ValidationError.Create("Organisation user does not belong to the current tenant"));
|
||||
|
||||
var changedTotal = await context.Organisations
|
||||
|
||||
Reference in New Issue
Block a user