Closes https://github.com/twentyhq/core-team-issues/issues/388 - Add object records-related permissions to role entity - Add it to queriable `currentUserWorkspace` (used in FE)
57 lines
1.3 KiB
TypeScript
57 lines
1.3 KiB
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
OneToMany,
|
|
PrimaryGeneratedColumn,
|
|
Relation,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
|
|
import { UserWorkspaceRoleEntity } from 'src/engine/metadata-modules/role/user-workspace-role.entity';
|
|
|
|
@Entity('role')
|
|
export class RoleEntity {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ nullable: false })
|
|
label: string;
|
|
|
|
@Column({ nullable: false, default: false })
|
|
canUpdateAllSettings: boolean;
|
|
|
|
@Column({ nullable: false, default: false })
|
|
canReadAllObjectRecords: boolean;
|
|
|
|
@Column({ nullable: false, default: false })
|
|
canUpdateAllObjectRecords: boolean;
|
|
|
|
@Column({ nullable: false, default: false })
|
|
canSoftDeleteAllObjectRecords: boolean;
|
|
|
|
@Column({ nullable: false, default: false })
|
|
canDestroyAllObjectRecords: boolean;
|
|
|
|
@Column({ nullable: true, type: 'text' })
|
|
description: string;
|
|
|
|
@Column({ nullable: false, type: 'uuid' })
|
|
workspaceId: string;
|
|
|
|
@CreateDateColumn({ type: 'timestamptz' })
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn({ type: 'timestamptz' })
|
|
updatedAt: Date;
|
|
|
|
@Column({ nullable: false, default: true })
|
|
isEditable: boolean;
|
|
|
|
@OneToMany(
|
|
() => UserWorkspaceRoleEntity,
|
|
(userWorkspaceRole: UserWorkspaceRoleEntity) => userWorkspaceRole.role,
|
|
)
|
|
userWorkspaceRoles: Relation<UserWorkspaceRoleEntity[]>;
|
|
}
|