Exemplo n.º 1
0
        public async Task <IActionResult> GetMissing(TimeclockEntryQueryDto dto)
        {
            //ensure the entry belongs to the current user and that the current user is still in the specified patrol
            if (User.PatrolIds().Any(x => x == dto.PatrolId) &&
                (dto.UserId == User.UserId() ||
                 User.RoleInPatrol(dto.PatrolId).CanMaintainTimeClock()))   //or the user is an admin
            {
                var entries = await _timeEntryRepository.GetMissingShiftTime(dto.PatrolId, dto.UserId, dto.From, dto.To);

                return(Ok(entries));
            }
            else
            {
                return(Forbid());
            }
        }