--
--  Accesss granted via tags; default is no accesss.
--  Permission must be explicitly granted.
--
--  Access permission is the disjunction of permit tags
--  Tags are split on "AND" to encode conjunction.
--
--  Note that nested routes automatically inherit all tags from the parent.
--
--  Admins always have access to entities within their assigned schools.
--
--  Access Tags:
--    !free       -- free for all
--    !lecturer   -- lecturer    for this course (or the school, if route is not connected to a course)
--    !corrector  -- corrector   for this sheet  (or the submission, if route is connected to a submission, or the course, if route is not connected to a sheet, or any course, if route is not connected to a course)
--    !registered -- participant for this course (no effect outside of courses)
--    !owner      -- part of the group of owners of this submission
--    !capacity   -- course this route is associated with has at least one unit of participant capacity
--
--    !materials  -- only if course allows all materials to be free (no meaning outside of courses)
--    !time       -- access depends on time somehow
--    !isRead     -- only if it is read-only access (i.e. GET but not POST)
--    !isWrite    -- only if it is write access     (i.e. POST only) why needed???
--
--    !deprecated -- like free, but logs and gives a warning; entirely disabled in production
--

/static StaticR Static appStatic                              !free
/auth   AuthR   Auth   getAuth                                !free

/favicon.ico FaviconR GET                                     !free
/robots.txt RobotsR GET                                       !free

/                           HomeR             GET             !free
/users                      UsersR            GET             -- no tags, i.e. admins only
/admin/test                 AdminTestR        GET POST
/admin/user/#CryptoUUIDUser AdminUserR        GET
/info                       VersionR          GET             !free

/profile                    ProfileR          GET POST        !free                             !free
/profile/data               ProfileDataR      GET             !free                             !free

/terms                      TermShowR         GET             !free
/terms/current              TermCurrentR      GET             !free
/terms/edit                 TermEditR         GET POST
/terms/#TermId/edit         TermEditExistR    GET
!/terms/#TermId             TermCourseListR   GET             !free

-- For Pattern Synonyms see Foundation
/course/                    CourseListR       GET             !free
!/course/new                CourseNewR        GET POST        !lecturer
/course/#TermId/#Text       CourseR                           !lecturer:
  /                           CShowR          GET             !free
  /register                   CRegisterR          POST        !timeANDcapacity
  /edit                       CEditR          GET POST
  /subs                       CCorrectionsR   GET POST
  /ex                         SheetListR      GET             !registered !materials
  !/ex/new                    SheetNewR       GET POST
  /ex/#Text SheetR:
    /                           SShowR        GET             !timeANDregistered !timeANDmaterials !corrector
    /edit                       SEditR        GET POST
    /delete                     SDelR         GET POST
    /subs                       SSubsR        GET POST
    /subs/new                   SubmissionNewR GET POST        !timeANDregistered
    /subs/own                   SubmissionOwnR GET             !free -- just redirect
    /sub/#CryptoFileNameSubmission SubmissionR !corrector:
      /                           SubShowR                   GET POST !ownerANDtime !ownerANDisRead
      /archive/#{ZIPArchiveName SubmissionFileType} SubArchiveR                GET      !owner
      /correction                 CorrectionR                GET POST !ownerANDisRead
      !/#SubmissionFileType/*FilePath SubDownloadR           GET      !owner
    /correctors                 SCorrR        GET POST
    !/#SheetFileType/*FilePath  SFileR        GET             !timeANDregistered !timeANDmaterials !corrector

/corrections  CorrectionsR GET POST !corrector !lecturer
/corrections/upload CorrectionsUploadR GET POST !corrector !lecturer


!/#UUID CryptoUUIDDispatchR GET                               !free -- just redirect
-- !/*{CI FilePath} CryptoFileNameDispatchR GET                  !free -- Disabled until preliminary check for valid cID exists
