chore(core): Hide invite URL in users list if not an admin (#17101)

This commit is contained in:
Andreas Fitzek
2025-07-09 15:58:20 +02:00
committed by GitHub
parent 336d6707e3
commit 3b46dec616
8 changed files with 73 additions and 41 deletions

View File

@@ -41,6 +41,7 @@ import { FolderService } from '@/services/folder.service';
import { ProjectService } from '@/services/project.service.ee';
import { UserService } from '@/services/user.service';
import { WorkflowService } from '@/workflows/workflow.service';
import { hasGlobalScope } from '@n8n/permissions';
@RestController('/users')
export class UsersController {
@@ -106,10 +107,12 @@ export class UsersController {
const [users, count] = response;
const withInviteUrl = hasGlobalScope(req.user, 'user:create');
const publicUsers = await Promise.all(
users.map(async (u) => {
const user = await this.userService.toPublic(u, {
withInviteUrl: true,
withInviteUrl,
inviterId: req.user.id,
});
return {