Skip to main content

Roles and permissions

This page describes the authorization model implemented by the current AFCT routes and interface.

Authorization model

AFCT combines one global administrator flag with a role on each course roster.

  • User.isAdmin grants system-wide administrator access.
  • Roster.role grants FACULTY, TA, or STUDENT access in one course.
  • There is no global Faculty, TA, or Student role.

A person can hold different roles in different courses. Each account has at most one role in a course because the roster is unique on (courseId, userId). An administrator may also appear on a course roster, but the administrator flag remains global.

AFCT reads these values from the database when it authorizes a request. Earlier versions used a global role enum on the user record, but that is no longer the active model.

Role summary

PrincipalScopeGeneral access
AdministratorEntire systemAll active courses, account administration, system settings, logs, status, and updates
FacultyOne assigned courseTeaching content, grading, groups, activity, and full roster management
TAOne assigned courseTeaching content, grading, groups, activity, and student enrollment
StudentOne assigned coursePublished course content and their own work
Signed-out or inactive accountNoneNo authenticated access

The term course staff means Faculty or TA. The two roles share most teaching permissions, but they are not identical. Faculty can change roster roles and remove eligible members. TAs cannot.

Administrators bypass normal course-role checks, but lifecycle rules still apply. For example, an archived course is read-only even for an administrator.

Course authorization helpers

Course routes use the helpers in src/lib/permissions.ts.

HelperRule
canAccessCourse(user, courseId)Allows an administrator, Faculty, or TA. Allows an enrolled student only after the course is published.
canManageCourse(user, courseId, roles?)Allows an administrator or an enrolled user whose course role is in the supplied role list. The default list is Faculty and TA.

Routes pass a Faculty-only role list for roster role changes and removals. Routes also add checks for archived, deleted, unpublished, or otherwise protected records.

Course lifecycle

Unpublished

Administrators and assigned course staff can open the course. Students receive 404 Not Found, even when they are enrolled.

Published

Enrolled students can open the course and its published assignments. Self-enrollment also requires a valid registration code and an open enrollment window.

An administrator or course staff member can publish or unpublish a course. Unpublishing is blocked once submissions or grades exist.

Archived

Only an administrator can archive or restore a course. Archived courses are read-only for everyone. Administrators and assigned course staff can view them, while students cannot.

AFCT also applies an archive safety check based on the stored course dates and activity.

Deleted

Only an administrator can delete a course. AFCT permanently deletes an empty course. A course with retained content or activity is soft-deleted instead.

A soft-deleted course remains in the database for record integrity but is hidden from every user, including administrators. Course routes return 404 Not Found, and there is no restore action in the interface.

Permission matrix

Courses and roster

ActionAdministratorFacultyTAStudent
View a courseAny active courseAssigned courseAssigned coursePublished and enrolled course
Create, duplicate, or delete a courseYesNoNoNo
Archive or restore a courseYesNoNoNo
Edit settings or publishYesAssigned, unarchived courseAssigned, unarchived courseNo
View the full rosterYesYesYesNo
Enroll one student or bulk enrollYesYesYesNo
Change a member's course roleYesYesNoNo
Remove an eligible roster memberYesYesNoNo
Self-enroll with a registration codeNot neededNot neededNot neededWhen publication and enrollment rules allow it
Remove selfNot applicableNoNoNo

Assignments and problems

ActionAdministratorFaculty or TAStudent
View an assignmentAny active courseAssigned coursePublished assignment in an accessible course
Create or edit an assignmentYesYes, unless archivedNo
Delete an assignmentYesYes, unless archived and only when protected activity does not existNo
Configure problems, points, attempt limits, and autogradingYesYes, unless archivedNo
Upload, replace, or download an answer fileYesYes, unless the write is blocked by archive stateNo

Students receive 404 Not Found for unpublished assignments. Once student work exists, several changes are blocked:

  • Unpublishing is blocked when submissions or grades exist.
  • Changing between individual and group mode is blocked after submissions exist.
  • Deletion is blocked when submissions or comments exist.

Submissions, grades, comments, and groups

ActionAdministratorFaculty or TAStudent
Submit workTest submissionTest submissionOwn work, subject to publication, date, cooldown, and attempt rules
View submissionsAll active coursesAssigned courseOwn work. A result route can also allow a groupmate when a submission record contains a group ID.
Delete a submissionNoNoNo
View gradesAll active coursesAssigned courseOwn grades
Override or rerun an evaluationYesYes, unless archivedNo
Export grades through the APIYesAssigned courseNo
Post or view commentsAll relevant threadsAssigned courseOwn thread
Delete a commentYesAssigned courseNo
Manage course groups and problem mappingsYesAssigned courseNo

The current course page exposes Export Grades only to system administrators, even though the grade export route accepts Faculty and TA access. Staff who do not see the button should ask an administrator for the export.

Manual grade overrides are recorded in the activity log. AFCT does not have a separate grade-release step, so completed evaluation results and later overrides are available to the student through their course view.

Students never receive answer files.

Group mode currently controls problem-to-group mappings in the course interface. The main submission, grade, and discussion workflow remains student-specific. Do not assume that saving one student's grade updates every group member.

Accounts and administration

ActionAdministratorFaculty or TAStudent
Create, activate, deactivate, or delete accountsYesNoNo
Grant administrator accessYesNoNo
Reset another account's passwordYesNoNo
Change own profile name, avatar, or timezoneYesYesYes
Change an account email addressNo interfaceNoNo
Manage system settings, status, logs, backups, or updatesYesNoNo
View course activityAny courseAssigned courseNo

An administrator can end a login lock early with Unlock account on User Accounts, and can reset an account's password from the same page. A lock also clears on its own once the configured lockout period passes.

Roster safeguards

  • Every course must retain at least one Faculty member.
  • A non-admin Faculty member cannot remove another Faculty member.
  • A roster member with submissions cannot be removed.
  • TAs cannot change course roles or remove roster members.
  • Students cannot remove themselves.
  • Only an administrator can change the system administrator flag.

A Faculty member can change another member's course role, including another Faculty member, as long as the change does not remove the course's last Faculty member.

Existence hiding

AFCT often returns 404 Not Found when a student asks for an unpublished, archived, deleted, or otherwise inaccessible course resource. This keeps hidden resources from being disclosed.

Routes use 403 Forbidden when the signed-in user can know that the resource exists but lacks permission for the requested action.