mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor(core): Standardize filename casing for controllers and databases (no-changelog) (#10564)
This commit is contained in:
34
packages/cli/src/databases/entities/auth-identity.ts
Normal file
34
packages/cli/src/databases/entities/auth-identity.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Column, Entity, ManyToOne, PrimaryColumn, Unique } from '@n8n/typeorm';
|
||||
import { WithTimestamps } from './abstract-entity';
|
||||
import { User } from './User';
|
||||
|
||||
export type AuthProviderType = 'ldap' | 'email' | 'saml'; // | 'google';
|
||||
|
||||
@Entity()
|
||||
@Unique(['providerId', 'providerType'])
|
||||
export class AuthIdentity extends WithTimestamps {
|
||||
@Column()
|
||||
userId: string;
|
||||
|
||||
@ManyToOne(() => User, (user) => user.authIdentities)
|
||||
user: User;
|
||||
|
||||
@PrimaryColumn()
|
||||
providerId: string;
|
||||
|
||||
@PrimaryColumn()
|
||||
providerType: AuthProviderType;
|
||||
|
||||
static create(
|
||||
user: User,
|
||||
providerId: string,
|
||||
providerType: AuthProviderType = 'ldap',
|
||||
): AuthIdentity {
|
||||
const identity = new AuthIdentity();
|
||||
identity.user = user;
|
||||
identity.userId = user.id;
|
||||
identity.providerId = providerId;
|
||||
identity.providerType = providerType;
|
||||
return identity;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user