🛡️ Safety: Prevent self-deactivation and fix staff UI
This commit is contained in:
@@ -64,7 +64,10 @@ export class UsersService {
|
||||
/**
|
||||
* تعطيل مستخدم
|
||||
*/
|
||||
async remove(tenantId: string, id: string): Promise<void> {
|
||||
async remove(tenantId: string, id: string, currentUserId: string): Promise<void> {
|
||||
if (id === currentUserId) {
|
||||
throw new ConflictException('لا يمكنك تعطيل حسابك الشخصي');
|
||||
}
|
||||
const user = await this.findOne(tenantId, id);
|
||||
await this.userRepository.update(id, { is_active: false });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user