Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update access to participant check-in system #326

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions apps/api/src/routers/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
from datetime import datetime
from logging import getLogger
from typing import Any, Optional, Sequence
from typing import Annotated, Any, Optional, Sequence

from fastapi import APIRouter, Body, Depends, HTTPException, status
from pydantic import BaseModel, EmailStr, Field, TypeAdapter, ValidationError
Expand All @@ -23,6 +23,9 @@
router = APIRouter()

ADMIN_ROLES = (Role.DIRECTOR, Role.REVIEWER, Role.CHECKIN_LEAD)
ORGANIZER_ROLES = (Role.ORGANIZER,)

require_checkin_associate = require_role(ADMIN_ROLES + ORGANIZER_ROLES)


class ApplicationDataSummary(BaseModel):
Expand Down Expand Up @@ -239,12 +242,7 @@ async def waitlist_release(uid: str) -> None:
log.info(f"Accepted {uid} off the waitlist and sent email.")


@router.get(
"/attending",
dependencies=[
Depends(require_role([Role.DIRECTOR, Role.ORGANIZER, Role.VOLUNTEER]))
],
)
@router.get("/attending", dependencies=[Depends(require_checkin_associate)])
async def attending() -> list[dict[str, object]]:
"""Get list of attending participants."""
# TODO: non-hackers
Expand All @@ -253,10 +251,7 @@ async def attending() -> list[dict[str, object]]:

@router.post("/checkin/{uid}")
async def checkin(
uid: str,
associate: User = Depends(
require_role([Role.DIRECTOR, Role.ORGANIZER, Role.VOLUNTEER])
),
uid: str, associate: Annotated[User, Depends(require_checkin_associate)]
) -> None:
"""Check in participant at IrvineHacks."""
try:
Expand Down
2 changes: 1 addition & 1 deletion apps/site/src/lib/admin/authorization.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const ADMIN_ROLES = ["director", "reviewer", "checkin_lead"];
const ORGANIZER_ROLES = ["organizer", "volunteer"];
const ORGANIZER_ROLES = ["organizer"];

export function isApplicationManager(role: string | null) {
return role !== null && ADMIN_ROLES.includes(role);
Expand Down
Loading