Skip to content

Commit 707b873

Browse files
committed
fix: update timeToLive to timeoutWindowExpression
1 parent 09cc919 commit 707b873

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/Pages/GlobalConfigurations/Authorization/types.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ export interface UserDto {
6464
*/
6565
lastLoginTime?: string
6666
/**
67-
* Time until which the user is active
68-
* Note: Only a user with status 'active' can have 'timeToLive'
67+
* Expression for the time until which the user is active
68+
* Note: Only a user with status 'active' can have 'timeoutWindowExpression'
6969
*
7070
* @default ''
7171
*/
72-
timeToLive?: string
72+
timeoutWindowExpression?: string
7373
/**
7474
* Role filters (direct permissions) for the user
7575
*/
@@ -87,7 +87,15 @@ export interface UserDto {
8787
roleGroups?: Pick<PermissionGroup, 'id' | 'name' | 'description'>
8888
}
8989

90-
export type User = UserDto
90+
export interface User extends Omit<UserDto, 'timeoutWindowExpression'> {
91+
/**
92+
* Time until which the user is active
93+
* Note: Only a user with status 'active' can have 'timeToLive'
94+
*
95+
* @default ''
96+
*/
97+
timeToLive?: string
98+
}
9199

92100
export type UserCreateOrUpdatePayload = Pick<
93101
User,

src/Pages/GlobalConfigurations/Authorization/utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@ import { PermissionGroup, User, UserDto } from './types'
55
import { LAST_LOGIN_TIME_NULL_STATE } from './UserPermissions/constants'
66

77
export const transformUserResponse = (_user: UserDto): User => {
8-
const { lastLoginTime, timeToLive, ...user } = _user
8+
const { lastLoginTime, timeoutWindowExpression, ...user } = _user
99

1010
return {
1111
...user,
1212
lastLoginTime:
1313
lastLoginTime === ZERO_TIME_STRING || !lastLoginTime
1414
? LAST_LOGIN_TIME_NULL_STATE
1515
: moment(lastLoginTime).format(Moment12HourFormat),
16-
timeToLive: timeToLive === ZERO_TIME_STRING || !timeToLive ? '' : moment(timeToLive).format(Moment12HourFormat),
16+
timeToLive:
17+
timeoutWindowExpression === ZERO_TIME_STRING || !timeoutWindowExpression
18+
? ''
19+
: moment(timeoutWindowExpression).format(Moment12HourFormat),
1720
}
1821
}
1922

0 commit comments

Comments
 (0)