Function is_valid

Source
pub async fn is_valid(
    user_id: i64,
    ticket_id: i64,
    module_id: i64,
    is_admin: bool,
    db: &DatabaseConnection,
) -> bool
Expand description

Returns whether user_id is allowed to view/post on a ticket in module_id.

Admins are always allowed.

Rules:

  • is_admin == true → allowed
  • Ticket author → allowed
  • Module staff (Lecturer, AssistantLecturer, Tutor) → allowed