mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Setup decorator based RBAC (no-changelog) (#5787)
This commit is contained in:
committed by
GitHub
parent
feb2ba09b9
commit
1eeadc6114
@@ -5,7 +5,7 @@ import { ErrorReporterProxy as ErrorReporter } from 'n8n-workflow';
|
||||
import { User } from '@db/entities/User';
|
||||
import { SharedCredentials } from '@db/entities/SharedCredentials';
|
||||
import { SharedWorkflow } from '@db/entities/SharedWorkflow';
|
||||
import { Delete, Get, Post, RestController } from '@/decorators';
|
||||
import { Authorized, NoAuthRequired, Delete, Get, Post, RestController } from '@/decorators';
|
||||
import {
|
||||
addInviteLinkToUser,
|
||||
generateUserInviteUrl,
|
||||
@@ -41,6 +41,7 @@ import type {
|
||||
UserRepository,
|
||||
} from '@db/repositories';
|
||||
|
||||
@Authorized(['global', 'owner'])
|
||||
@RestController('/users')
|
||||
export class UsersController {
|
||||
private config: Config;
|
||||
@@ -282,6 +283,7 @@ export class UsersController {
|
||||
/**
|
||||
* Fill out user shell with first name, last name, and password.
|
||||
*/
|
||||
@NoAuthRequired()
|
||||
@Post('/:id')
|
||||
async updateUser(req: UserRequest.Update, res: Response) {
|
||||
const { id: inviteeId } = req.params;
|
||||
@@ -343,6 +345,7 @@ export class UsersController {
|
||||
return withFeatureFlags(this.postHog, sanitizeUser(updatedUser));
|
||||
}
|
||||
|
||||
@Authorized('any')
|
||||
@Get('/')
|
||||
async listUsers(req: UserRequest.List) {
|
||||
const users = await this.userRepository.find({ relations: ['globalRole', 'authIdentities'] });
|
||||
|
||||
Reference in New Issue
Block a user