System decks/notes are owned by a reserved sentinel user id, reusing all existing per-user store/index plumbing unchanged. Regular users see them under a separate "Official Decks" section, can study them with fully independent per-user FSRS progress (lazily materialized on first visit), but can never edit or archive them - enforced both in the client (no Edit/Archive controls) and server-side (ownership guard on every mutating endpoint). Includes a small idempotent seed command (`dotnet run -- seed-flashcards`) for testing, since there's no in-app authoring UI yet.
9 lines
363 B
C#
9 lines
363 B
C#
namespace QuestionsApi.Services.Flashcards;
|
|
|
|
// Pure authorization decision for mutating a flashcard deck/note, kept dependency-free (like
|
|
// FlashcardScheduling) so it's unit testable without a controller or Mongo.
|
|
public static class FlashcardOwnershipGuard
|
|
{
|
|
public static bool CanMutate(bool isSuper, bool targetIsSystem) => isSuper || !targetIsSystem;
|
|
}
|