fix(core): All calls to plainToInstance should exclude extraneous values (no-changelog) (#9338)
This commit is contained in:
committed by
GitHub
parent
9003c15811
commit
5025d209ca
@@ -10,6 +10,7 @@ import type {
|
||||
IUser,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { Expose } from 'class-transformer';
|
||||
import { IsBoolean, IsEmail, IsIn, IsOptional, IsString, Length } from 'class-validator';
|
||||
import { NoXss } from '@db/utils/customValidators';
|
||||
import type { PublicUser, SecretsProvider, SecretsProviderState } from '@/Interfaces';
|
||||
@@ -20,14 +21,17 @@ import type { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
||||
import type { WorkflowHistory } from '@db/entities/WorkflowHistory';
|
||||
|
||||
export class UserUpdatePayload implements Pick<User, 'email' | 'firstName' | 'lastName'> {
|
||||
@Expose()
|
||||
@IsEmail()
|
||||
email: string;
|
||||
|
||||
@Expose()
|
||||
@NoXss()
|
||||
@IsString({ message: 'First name must be of type string.' })
|
||||
@Length(1, 32, { message: 'First name must be $constraint1 to $constraint2 characters long.' })
|
||||
firstName: string;
|
||||
|
||||
@Expose()
|
||||
@NoXss()
|
||||
@IsString({ message: 'Last name must be of type string.' })
|
||||
@Length(1, 32, { message: 'Last name must be $constraint1 to $constraint2 characters long.' })
|
||||
@@ -35,16 +39,19 @@ export class UserUpdatePayload implements Pick<User, 'email' | 'firstName' | 'la
|
||||
}
|
||||
|
||||
export class UserSettingsUpdatePayload {
|
||||
@Expose()
|
||||
@IsBoolean({ message: 'userActivated should be a boolean' })
|
||||
@IsOptional()
|
||||
userActivated: boolean;
|
||||
|
||||
@Expose()
|
||||
@IsBoolean({ message: 'allowSSOManualLogin should be a boolean' })
|
||||
@IsOptional()
|
||||
allowSSOManualLogin?: boolean;
|
||||
}
|
||||
|
||||
export class UserRoleChangePayload {
|
||||
@Expose()
|
||||
@IsIn(['global:admin', 'global:member'])
|
||||
newRoleName: AssignableRole;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user