after Discussion today
This commit is contained in:
parent
f14bea4015
commit
f4964dcb55
@ -21,12 +21,16 @@ SheetDelTitle tid@TermIdentifier courseShortHand@Text sheetName@Text: Übun
|
|||||||
SheetDelText submissionNo@Int: Dies kann nicht mehr rückgängig gemacht werden! Alle Einreichungen gehen ebenfalls verloren! Es gibt #{show submissionNo} Abgaben.
|
SheetDelText submissionNo@Int: Dies kann nicht mehr rückgängig gemacht werden! Alle Einreichungen gehen ebenfalls verloren! Es gibt #{show submissionNo} Abgaben.
|
||||||
SheetDelOk tid@TermIdentifier courseShortHand@Text sheetName@Text: #{termToText tid}-#{courseShortHand}: Übungsblatt #{sheetName} gelöscht.
|
SheetDelOk tid@TermIdentifier courseShortHand@Text sheetName@Text: #{termToText tid}-#{courseShortHand}: Übungsblatt #{sheetName} gelöscht.
|
||||||
|
|
||||||
|
Unauthorized: Sie haben hierfür keine explizite Berechtigung.
|
||||||
|
UnauthorizedAnd l@Text r@Text: "#{l}" und "#{r}"
|
||||||
|
UnauthorizedOr l@Text r@Text: "#{l}" oder "#{r}"
|
||||||
UnauthorizedSchoolAdmin: Sie sind nicht als Administrator für dieses Institut eingetragen.
|
UnauthorizedSchoolAdmin: Sie sind nicht als Administrator für dieses Institut eingetragen.
|
||||||
UnauthorizedSchoolLecturer: Sie sind nicht als Veranstalter für dieses Institut eingetragen.
|
UnauthorizedSchoolLecturer: Sie sind nicht als Veranstalter für dieses Institut eingetragen.
|
||||||
UnauthorizedLecturer: Sie sind nicht als Veranstalter für diese Veranstaltung eingetragen.
|
UnauthorizedLecturer: Sie sind nicht als Veranstalter für diese Veranstaltung eingetragen.
|
||||||
UnauthorizedCorrector: Sie sind nicht als Korrektor für diese Veranstaltung eingetragen.
|
UnauthorizedCorrector: Sie sind nicht als Korrektor für diese Veranstaltung eingetragen.
|
||||||
UnauthorizedParticipant: Sie sind nicht als Teilnehmer für diese Veranstaltung registriert.
|
UnauthorizedParticipant: Sie sind nicht als Teilnehmer für diese Veranstaltung registriert.
|
||||||
OnlyUploadOneFile: Bitte nur eine Datei hochladen.
|
OnlyUploadOneFile: Bitte nur eine Datei hochladen.
|
||||||
|
DeprecatedRoute: Diese Ansicht ist obsolet und könnte in Zukunft entfallen.
|
||||||
|
|
||||||
SubmissionWrongSheet: Abgabenummer gehört nicht zum angegebenen Übungsblatt.
|
SubmissionWrongSheet: Abgabenummer gehört nicht zum angegebenen Übungsblatt.
|
||||||
SubmissionAlreadyExists: Sie haben bereits eine Abgabe zu diesem Übungsblatt.
|
SubmissionAlreadyExists: Sie haben bereits eine Abgabe zu diesem Übungsblatt.
|
||||||
|
|||||||
4
routes
4
routes
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
Admins always have access to entities within their assigned schools.
|
Admins always have access to entities within their assigned schools.
|
||||||
|
|
||||||
Tags:
|
Access Tags:
|
||||||
!free -- free for all
|
!free -- free for all
|
||||||
!lecturer -- lecturer for this course (or the school, if route is not connected to a course)
|
!lecturer -- lecturer for this course (or the school, if route is not connected to a course)
|
||||||
!corrector -- corrector for this sheet (or the course, if route is not connected to a sheet )
|
!corrector -- corrector for this sheet (or the course, if route is not connected to a sheet )
|
||||||
@ -39,7 +39,7 @@
|
|||||||
-- For Pattern Synonyms see Foundation
|
-- For Pattern Synonyms see Foundation
|
||||||
/course/ CourseListR GET !free
|
/course/ CourseListR GET !free
|
||||||
!/course/new CourseNewR GET POST !lecturer
|
!/course/new CourseNewR GET POST !lecturer
|
||||||
/course/#TermId/#Text CourseR !lecturer !updateFavourite:
|
/course/#TermId/#Text CourseR !lecturer:
|
||||||
/show CShowR GET POST !free
|
/show CShowR GET POST !free
|
||||||
/edit CEditR GET POST
|
/edit CEditR GET POST
|
||||||
/ex SheetListR GET !materials
|
/ex SheetListR GET !materials
|
||||||
|
|||||||
@ -59,7 +59,8 @@ import System.FilePath
|
|||||||
|
|
||||||
import Handler.Utils.Templates
|
import Handler.Utils.Templates
|
||||||
import Handler.Utils.StudyFeatures
|
import Handler.Utils.StudyFeatures
|
||||||
|
import Control.Lens
|
||||||
|
import Utils.Lens
|
||||||
|
|
||||||
-- infixl 9 :$:
|
-- infixl 9 :$:
|
||||||
-- pattern a :$: b = a b
|
-- pattern a :$: b = a b
|
||||||
@ -144,22 +145,31 @@ knownTags =
|
|||||||
return Authorized
|
return Authorized
|
||||||
)
|
)
|
||||||
,("lecturer", APDB $ \case
|
,("lecturer", APDB $ \case
|
||||||
CourseR tid csh ->
|
CourseR tid csh -> maybeT (unauthorizedI MsgUnauthorizedLecturer) $ do
|
||||||
(>>= maybe (unauthorizedI MsgUnauthorizedLecturer) return) . runMaybeT $ do
|
|
||||||
authId <- lift requireAuthId
|
authId <- lift requireAuthId
|
||||||
Entity cid _ <- MaybeT . getBy $ CourseTermShort tid csh
|
Entity cid _ <- MaybeT . getBy $ CourseTermShort tid csh
|
||||||
void . MaybeT . getBy $ UniqueLecturer authId cid
|
void . MaybeT . getBy $ UniqueLecturer authId cid
|
||||||
return Authorized
|
return Authorized
|
||||||
|
|
||||||
_ -> do
|
_ -> do
|
||||||
authId <- requireAuthId
|
authId <- requireAuthId
|
||||||
mul <- selectFirst [UserLecturerUser ==. authId] []
|
mul <- selectFirst [UserLecturerUser ==. authId] []
|
||||||
case mul of
|
case mul of
|
||||||
Nothing -> unauthorizedI $ MsgUnauthorizedSchoolLecturer
|
Nothing -> unauthorizedI $ MsgUnauthorizedSchoolLecturer
|
||||||
(Just _) -> return Authorized
|
(Just _) -> return Authorized
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
declareWrapped [d|
|
||||||
|
newtype DNF a = DNF (Set (Set a)) -- disjunctive Normalform
|
||||||
|
|]
|
||||||
|
|
||||||
|
|
||||||
|
getAccess :: Route UniWorX -> DNF AccessPredicate
|
||||||
|
getAccess r = DNF $ Set.map attrsAND attrsOR
|
||||||
|
where
|
||||||
|
attrsOR = routeAttrs r
|
||||||
|
attrsAND = Set.fromList . Map.elems . Map.restrictKeys knownTags . Set.fromList . splitOn "AND"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Menus and Favourites
|
-- Menus and Favourites
|
||||||
|
|||||||
@ -5,7 +5,7 @@ module Utils.Common where
|
|||||||
-- Common Utility Functions
|
-- Common Utility Functions
|
||||||
|
|
||||||
import Language.Haskell.TH
|
import Language.Haskell.TH
|
||||||
|
import Control.Monad.Trans.Maybe
|
||||||
|
|
||||||
------------
|
------------
|
||||||
-- Tuples --
|
-- Tuples --
|
||||||
@ -50,3 +50,11 @@ altFun perm = lamE pat rhs
|
|||||||
ps = [ xs !! (j-1) | j <- perm ]
|
ps = [ xs !! (j-1) | j <- perm ]
|
||||||
fn = mkName "fn"
|
fn = mkName "fn"
|
||||||
|
|
||||||
|
|
||||||
|
-----------
|
||||||
|
-- Maybe --
|
||||||
|
-----------
|
||||||
|
|
||||||
|
maybeT :: Monad m => m a -> MaybeT m a -> m a
|
||||||
|
maybeT x m = runMaybeT m >>= maybe x return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user