fix: let only the owner set logout time and move the attendance tab
This commit is contained in:
@@ -68,7 +68,7 @@ export class UsersController {
|
||||
}
|
||||
|
||||
@Patch(':id/logout-time')
|
||||
@Roles('owner', 'admin')
|
||||
@Roles('owner')
|
||||
updateLogoutTime(
|
||||
@CurrentUser() user: { organizationId: string; role: UserRole },
|
||||
@Param('id') id: string,
|
||||
|
||||
@@ -249,8 +249,8 @@ export class UsersService {
|
||||
targetId: string,
|
||||
logoutTime: string | null,
|
||||
): Promise<OrgUserDto> {
|
||||
if (actorRole !== 'owner' && actorRole !== 'admin') {
|
||||
throw new ForbiddenException('فقط مالک یا مدیر میتواند ساعت خروج را تعیین کند');
|
||||
if (actorRole !== 'owner') {
|
||||
throw new ForbiddenException('فقط مالک میتواند ساعت خروج را تعیین کند');
|
||||
}
|
||||
const target = await this.memberships.findUserInOrgById(organizationId, targetId);
|
||||
if (!target) throw new NotFoundException('کاربر پیدا نشد');
|
||||
|
||||
Reference in New Issue
Block a user