Skip to content

Commit 49496ec

Browse files
committed
Disallow non-approved hackers
1 parent 92dea44 commit 49496ec

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

api/api/views/scan/events.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from hackfsu_com.views.generic import ApiView
99
from hackfsu_com.util.forms import JsonField
1010
from hackfsu_com.util import acl
11-
from api.models import Hackathon, ScanEvent, ScanRecord, UserInfo
11+
from api.models import Hackathon, ScanEvent, ScanRecord, UserInfo, HackerInfo
1212
from api.models.attendee_status import AttendeeStatusManager
1313

1414
class ScanEventsView(ApiView):
@@ -76,6 +76,18 @@ def work(self, request, req, res):
7676
current_hackathon = Hackathon.objects.current()
7777
attendee_info = AttendeeStatusManager.get_or_create(user, current_hackathon)
7878

79+
# If hacker, make sure they are approved
80+
try:
81+
hacker_info = HackerInfo.objects.get(hackathon=current_hackathon, user=user)
82+
if not hacker_info.approved:
83+
res['name'] = name
84+
res['message'] = "{} was not accepted.".format(name)
85+
res['status'] = 401
86+
return
87+
except:
88+
pass
89+
90+
7991
attendee_info.checked_in_at = timezone.now()
8092
attendee_info.save()
8193

0 commit comments

Comments
 (0)