Skip to content

application specific: Ensure only allowed person (usually admin ) is allowed to ... #427

Open
@github-actions

Description

@github-actions

application specific: Ensure only allowed person (usually admin ) is allowed to delete

// TODO application specific: Ensure only allowed person (usually admin ) is allowed to delete

  ): Promise<PrivateFile> {
    return this.fileService.getPrivateFile(getPrivateFileArgs);
  }

  /**
   * Deletes a private file
   * @param {DeleteFileInput} deleteFileInput - contains UUID
   * @returns {Promise<PrivateFile>} - the file that was deleted
   */
  @LoggedIn() // TODO application specific: set appropriate guards here
  @Mutation(() => User)
  async deletePrivateFile(
    @Args('deleteFileInput')
    deleteFileInput: DeleteFileInput,
  ): Promise<PrivateFile> {
    // TODO application specific: Ensure only allowed person (usually admin or file owner) is allowed to delete
    return this.fileService.deleteFile(
      deleteFileInput,
      false,
    ) as unknown as PrivateFile;
  }

  /**
   * Deletes a public file
   * @param {DeleteFileInput} deleteFileInput - contains UUID
   * @returns {Promise<PrivateFile>} - the file that was deleted
   */
  @LoggedIn() // TODO application specific: set appropriate guards here
  @Mutation(() => User)
  async deletePublicFile(
    @Args('deleteFileInput')
    deleteFileInput: DeleteFileInput,
  ): Promise<PublicFile> {
    // TODO application specific: Ensure only allowed person (usually admin ) is allowed to delete
    return this.fileService.deleteFile(
      deleteFileInput,
      true,
    ) as unknown as PublicFile;
  }
}

e66dd2c25295918fb28c6236b95f392c717c380a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions