Browse Source
Feature/allow date range change for demo user (#1243)
* Allow date range change
* Update changelog
pull/1242/head^2
Thomas Kaul
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
13 additions and
0 deletions
-
CHANGELOG.md
-
apps/api/src/app/user/user.controller.ts
|
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. |
|
|
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), |
|
|
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
|
|
|
|
|
|
|
## Unreleased |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Allowed the date range change for the demo user |
|
|
|
|
|
|
|
## 1.190.0 - 10.09.2022 |
|
|
|
|
|
|
|
### Added |
|
|
|
|
|
@ -22,6 +22,7 @@ import { JwtService } from '@nestjs/jwt'; |
|
|
|
import { AuthGuard } from '@nestjs/passport'; |
|
|
|
import { User as UserModel } from '@prisma/client'; |
|
|
|
import { StatusCodes, getReasonPhrase } from 'http-status-codes'; |
|
|
|
import { size } from 'lodash'; |
|
|
|
|
|
|
|
import { UserItem } from './interfaces/user-item.interface'; |
|
|
|
import { UpdateUserSettingDto } from './update-user-setting.dto'; |
|
|
@ -100,6 +101,12 @@ export class UserController { |
|
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
|
public async updateUserSetting(@Body() data: UpdateUserSettingDto) { |
|
|
|
if ( |
|
|
|
size(data) === 1 && |
|
|
|
data.dateRange && |
|
|
|
this.request.user.role === 'DEMO' |
|
|
|
) { |
|
|
|
// Allow date range change for demo user
|
|
|
|
} else if ( |
|
|
|
!hasPermission( |
|
|
|
this.request.user.permissions, |
|
|
|
permissions.updateUserSettings |
|
|
|