fix: let only the owner set logout time and move the attendance tab

This commit is contained in:
2026-10-19 13:54:09 +03:30
parent 8590579605
commit f15ebb72ea
4 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -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,
+2 -2
View File
@@ -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('کاربر پیدا نشد');