mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 03:06:31 -05:00
Add PermissionModule and GroupsModule
Both currently contain only the database entities, taken from the schema. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
97cc2085af
commit
637b16abda
6 changed files with 63 additions and 0 deletions
|
@ -7,6 +7,8 @@ import { RevisionsModule } from './revisions/revisions.module';
|
||||||
import { AuthorsModule } from './authors/authors.module';
|
import { AuthorsModule } from './authors/authors.module';
|
||||||
import { HistoryModule } from './history/history.module';
|
import { HistoryModule } from './history/history.module';
|
||||||
import { MonitoringModule } from './monitoring/monitoring.module';
|
import { MonitoringModule } from './monitoring/monitoring.module';
|
||||||
|
import { PermissionsModule } from './permissions/permissions.module';
|
||||||
|
import { GroupsModule } from './groups/groups.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -23,6 +25,8 @@ import { MonitoringModule } from './monitoring/monitoring.module';
|
||||||
PublicApiModule,
|
PublicApiModule,
|
||||||
HistoryModule,
|
HistoryModule,
|
||||||
MonitoringModule,
|
MonitoringModule,
|
||||||
|
PermissionsModule,
|
||||||
|
GroupsModule,
|
||||||
],
|
],
|
||||||
controllers: [],
|
controllers: [],
|
||||||
providers: [],
|
providers: [],
|
||||||
|
|
23
src/groups/group.entity.ts
Normal file
23
src/groups/group.entity.ts
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm/index';
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class Group {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
unique: true,
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
displayName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is set to denote a special group
|
||||||
|
* Special groups are used to map the old share settings like "everyone can edit"
|
||||||
|
* or "logged in users can view" to the group permission system
|
||||||
|
*/
|
||||||
|
@Column()
|
||||||
|
special: boolean;
|
||||||
|
}
|
4
src/groups/groups.module.ts
Normal file
4
src/groups/groups.module.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
|
||||||
|
@Module({})
|
||||||
|
export class GroupsModule {}
|
14
src/permissions/note-group-permission.entity.ts
Normal file
14
src/permissions/note-group-permission.entity.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import { Column, ManyToOne } from 'typeorm/index';
|
||||||
|
import { Group } from '../groups/group.entity';
|
||||||
|
import { Note } from '../notes/note.entity';
|
||||||
|
|
||||||
|
export class NoteGroupPermission {
|
||||||
|
@ManyToOne(_ => Group)
|
||||||
|
group: Group;
|
||||||
|
|
||||||
|
@ManyToOne(_ => Note)
|
||||||
|
note: Note;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
canEdit: boolean;
|
||||||
|
}
|
14
src/permissions/note-user-permission.entity.ts
Normal file
14
src/permissions/note-user-permission.entity.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import { Column, ManyToOne } from 'typeorm/index';
|
||||||
|
import { Note } from '../notes/note.entity';
|
||||||
|
import { User } from '../users/user.entity';
|
||||||
|
|
||||||
|
export class NoteUserPermission {
|
||||||
|
@ManyToOne(_ => User)
|
||||||
|
user: User;
|
||||||
|
|
||||||
|
@ManyToOne(_ => Note)
|
||||||
|
note: Note;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
canEdit: boolean;
|
||||||
|
}
|
4
src/permissions/permissions.module.ts
Normal file
4
src/permissions/permissions.module.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
|
||||||
|
@Module({})
|
||||||
|
export class PermissionsModule {}
|
Loading…
Reference in a new issue