Implemented new Permission system on the DB side.

ref #22
This commit is contained in:
2020-12-17 20:46:54 +01:00
parent 39b932a81c
commit cc5a30980a
6 changed files with 64 additions and 56 deletions

View File

@@ -1,22 +1,16 @@
import { IsBoolean, IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsString, IsUUID } from "class-validator";
import { Column, Entity, JoinTable, ManyToMany, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { ChildEntity, Column, JoinTable, ManyToMany, OneToMany } from "typeorm";
import { config } from '../../config';
import { Permission } from './Permission';
import { Principal } from './Principal';
import { UserAction } from './UserAction';
import { UserGroup } from './UserGroup';
/**
* Defines a admin user.
*/
@Entity()
export class User {
/**
* autogenerated unique id (primary key).
*/
@PrimaryGeneratedColumn()
@IsInt()
id: number;
@ChildEntity()
export class User extends Principal {
/**
* uuid
*/
@@ -78,13 +72,6 @@ export class User {
@IsNotEmpty()
password: string;
/**
* permissions
*/
@IsOptional()
@ManyToOne(() => Permission, permission => permission.users, { nullable: true })
permissions?: Permission[];
/**
* groups
*/