mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat(core): Rebuild project roles to load from the database (#17909)
This commit is contained in:
committed by
GitHub
parent
ab7998b441
commit
f757790394
@@ -1,3 +1,5 @@
|
||||
import { PROJECT_OWNER_ROLE_SLUG } from '@n8n/permissions';
|
||||
|
||||
import { ChangeUserRoleInProject } from '../change-user-role-in-project.dto';
|
||||
|
||||
describe('ChangeUserRoleInProject', () => {
|
||||
@@ -38,7 +40,7 @@ describe('ChangeUserRoleInProject', () => {
|
||||
},
|
||||
{
|
||||
name: 'personal owner role',
|
||||
request: { role: 'project:personalOwner' },
|
||||
request: { role: PROJECT_OWNER_ROLE_SLUG },
|
||||
expectedErrorPath: ['role'],
|
||||
},
|
||||
])('should reject $name', ({ request, expectedErrorPath }) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { projectRoleSchema } from '@n8n/permissions';
|
||||
import { teamRoleSchema } from '@n8n/permissions';
|
||||
import { Z } from 'zod-class';
|
||||
|
||||
export class ChangeUserRoleInProject extends Z.class({
|
||||
role: projectRoleSchema.exclude(['project:personalOwner']),
|
||||
role: teamRoleSchema,
|
||||
}) {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { projectRoleSchema } from '@n8n/permissions';
|
||||
import { teamRoleSchema } from '@n8n/permissions';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const projectNameSchema = z.string().min(1).max(255);
|
||||
@@ -16,6 +16,6 @@ export const projectDescriptionSchema = z.string().max(512);
|
||||
|
||||
export const projectRelationSchema = z.object({
|
||||
userId: z.string().min(1),
|
||||
role: projectRoleSchema.exclude(['project:personalOwner']),
|
||||
role: teamRoleSchema,
|
||||
});
|
||||
export type ProjectRelation = z.infer<typeof projectRelationSchema>;
|
||||
|
||||
Reference in New Issue
Block a user