2021-01-05 16:12:38 -05:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2020-07-26 14:58:40 -04:00
|
|
|
import { IsArray, IsBoolean, IsString, ValidateNested } from 'class-validator';
|
2020-07-25 14:24:59 -04:00
|
|
|
import { UserInfoDto } from '../users/user-info.dto';
|
|
|
|
|
2020-07-26 16:34:04 -04:00
|
|
|
export class NoteUserPermissionEntryDto {
|
2020-07-25 14:24:59 -04:00
|
|
|
@ValidateNested()
|
|
|
|
user: UserInfoDto;
|
|
|
|
@IsBoolean()
|
|
|
|
canEdit: boolean;
|
|
|
|
}
|
|
|
|
|
2020-10-03 06:42:14 -04:00
|
|
|
export class NoteUserPermissionUpdateDto {
|
2020-07-26 14:58:40 -04:00
|
|
|
@IsString()
|
|
|
|
username: string;
|
|
|
|
@IsBoolean()
|
|
|
|
canEdit: boolean;
|
|
|
|
}
|
|
|
|
|
2020-07-26 16:34:04 -04:00
|
|
|
export class GroupInfoDto {
|
|
|
|
@IsString()
|
2020-07-27 16:38:46 -04:00
|
|
|
name: string;
|
2020-07-26 16:34:04 -04:00
|
|
|
@IsString()
|
2020-07-27 16:38:46 -04:00
|
|
|
displayName: string;
|
|
|
|
@IsBoolean()
|
|
|
|
special: boolean;
|
2020-07-26 16:34:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export class NoteGroupPermissionEntryDto {
|
|
|
|
@ValidateNested()
|
2020-07-27 16:38:46 -04:00
|
|
|
group: GroupInfoDto;
|
2020-07-26 16:34:04 -04:00
|
|
|
@IsBoolean()
|
2020-07-27 16:38:46 -04:00
|
|
|
canEdit: boolean;
|
2020-07-26 16:34:04 -04:00
|
|
|
}
|
|
|
|
|
2020-10-03 06:42:14 -04:00
|
|
|
export class NoteGroupPermissionUpdateDto {
|
|
|
|
@IsString()
|
|
|
|
groupname: string;
|
|
|
|
@IsBoolean()
|
|
|
|
canEdit: boolean;
|
|
|
|
}
|
|
|
|
|
2020-07-25 14:24:59 -04:00
|
|
|
export class NotePermissionsDto {
|
|
|
|
@ValidateNested()
|
|
|
|
owner: UserInfoDto;
|
|
|
|
@ValidateNested()
|
|
|
|
@IsArray()
|
2020-07-26 16:34:04 -04:00
|
|
|
sharedToUsers: NoteUserPermissionEntryDto[];
|
|
|
|
@ValidateNested()
|
|
|
|
@IsArray()
|
|
|
|
sharedToGroups: NoteGroupPermissionEntryDto[];
|
2020-07-25 14:24:59 -04:00
|
|
|
}
|
2020-07-26 14:58:40 -04:00
|
|
|
|
|
|
|
export class NotePermissionsUpdateDto {
|
|
|
|
@IsArray()
|
|
|
|
@ValidateNested()
|
2020-10-03 06:42:14 -04:00
|
|
|
sharedToUsers: NoteUserPermissionUpdateDto[];
|
|
|
|
@IsArray()
|
|
|
|
@ValidateNested()
|
|
|
|
sharedToGroups: NoteGroupPermissionUpdateDto[];
|
2020-07-26 14:58:40 -04:00
|
|
|
}
|