feat(auth): record student ldap role

This commit is contained in:
Gregor Kleen 2020-12-10 19:09:33 +01:00
parent aba673756e
commit 50455e68a1
6 changed files with 14 additions and 0 deletions

View File

@ -550,6 +550,7 @@ UnauthorizedWorkflowWorkflowsNotEmpty: Es gibt laufende Workflows, die Sie einse
UnauthorizedWorkflowFiles: Sie dürfen die angegebenen Workflow-Dateien nicht im angegebenen historischen Zustand herunterladen
UnauthorizedNotAuthenticatedInDifferentApproot: Sie konnten im Kontext einer separierten Domain (z.B. zum sicheren Download von Dateien) nicht authentifiziert werden. Vermutlich haben Sie kein oder ein abgelaufenes Token verwendet. Sie können versuchen auf die gewünschte Resource mit einem neu generierten Download-Link zuzugreifen.
UnauthorizedCsrfDisabled: Ihre Anfrage hätte wmgl. Änderungen am Server-Zustand ausgelöst. Da die sog. CSRF-Protection für Ihre Anfrage deaktiviert ist, musste sie daher abgelehnt werden.
UnauthorizedStudent: Sie sind kein Student
WorkflowRoleUserMismatch: Sie sind nicht einer der vom Workflow geforderten Benutzer
WorkflowRoleAlreadyInitiated: Dieser Workflow wurde bereits initiiert
@ -1597,6 +1598,7 @@ AuthTagRead: Zugriff ist nur lesend
AuthTagWrite: Zugriff ist i.A. schreibend
AuthTagSubmissionGroup: Nutzer ist Mitglied in registrierter Abgabegruppe
AuthTagWorkflow: Nutzer hat passende Workflow-Rolle
AuthTagStudent: Nutzer ist Student
DeleteCopyStringIfSure n@Int: Wenn Sie sich sicher sind, dass Sie #{pluralDE n "das obige Objekt" "obige Objekte"} unwiderbringlich löschen möchten, schreiben Sie bitte zunächst den angezeigten Text ab.
DeletePressButtonIfSure n@Int: Wenn Sie sich sicher sind, dass Sie #{pluralDE n "das obige Objekt" "obige Objekte"} unwiderbringlich löschen möchten, bestätigen Sie dies bitte durch Drücken des untigen Knopfes.
@ -2986,6 +2988,7 @@ CronMatchNone: Nie
SystemExamOffice: Prüfungsverwaltung
SystemFaculty: Fakultätsmitglied
SystemStudent: Student
WorkflowScopeKindGlobal: Systemweit
WorkflowScopeKindTerm: Pro Semester

View File

@ -547,6 +547,7 @@ UnauthorizedWorkflowWorkflowsNotEmpty: There are running workflows, which you ma
UnauthorizedWorkflowFiles: You are not allowed to download the given workflow files in the given historical state
UnauthorizedNotAuthenticatedInDifferentApproot: You could not be authenticated in the context of a separate domain (e.g. for secure downloading of files). You probably used no or an expired token. You can try to access the resource with a newly generated download link.
UnauthorizedCsrfDisabled: Your request might have triggered a state change on the server. Since CSRF-protection was disabled for your request, it had to be rejected.
UnauthorizedStudent: You are not a student.
WorkflowRoleUserMismatch: You aren't any of the users authorized by the workflow
WorkflowRoleAlreadyInitiated: This workflow was already initiated
@ -1597,6 +1598,7 @@ AuthTagRead: Access is read only
AuthTagWrite: Access might write
AuthTagSubmissionGroup: User is part of a submission group
AuthTagWorkflow: User has matching workflow role
AuthTagStudent: User is a student
DeleteCopyStringIfSure n: If you are sure that you want to permanently delete the #{pluralEN n "object" "objects"} listed below, please copy the shown text.
DeletePressButtonIfSure n: If you are sure that you want to permanently delete the #{pluralEN n "object" "objects"} listed below, please confirm the action by pressing the button.
@ -2987,6 +2989,7 @@ CronMatchNone: Never
SystemExamOffice: Exam office
SystemFaculty: Faculty member
SystemStudent: Student
WorkflowScopeKindGlobal: Global
WorkflowScopeKindTerm: Per term

View File

@ -360,6 +360,11 @@ tagAccessPredicate AuthSystemExamOffice = APDB $ \_ mAuthId _ _ -> $cachedHereBi
isExamOffice <- lift $ exists [UserSystemFunctionUser ==. authId, UserSystemFunctionFunction ==. SystemExamOffice, UserSystemFunctionIsOptOut ==. False]
guardMExceptT isExamOffice $ unauthorizedI MsgUnauthorizedSystemExamOffice
return Authorized
tagAccessPredicate AuthStudent = APDB $ \_ mAuthId _ _ -> $cachedHereBinary mAuthId . exceptT return return $ do
authId <- maybeExceptT AuthenticationRequired $ return mAuthId
isExamOffice <- lift $ exists [UserSystemFunctionUser ==. authId, UserSystemFunctionFunction ==. SystemStudent, UserSystemFunctionIsOptOut ==. False]
guardMExceptT isExamOffice $ unauthorizedI MsgUnauthorizedStudent
return Authorized
tagAccessPredicate AuthExamOffice = APDB $ \_ mAuthId route _ -> case route of
CExamR tid ssh csh examn _ -> $cachedHereBinary (mAuthId, tid, ssh, csh, examn) . exceptT return return $ do
authId <- maybeExceptT AuthenticationRequired $ return mAuthId

View File

@ -11,3 +11,4 @@ determineSystemFunctions :: Set (CI Text) -> (SystemFunction -> Bool)
determineSystemFunctions ldapFuncs = \case
SystemExamOffice -> False
SystemFaculty -> "faculty" `Set.member` ldapFuncs
SystemStudent -> "student" `Set.member` ldapFuncs

View File

@ -65,6 +65,7 @@ data AuthTag -- sortiert nach gewünschter Reihenfolge auf /authpreds, d.h. Prä
| AuthExamResult
| AuthParticipant
| AuthApplicant
| AuthStudent
| AuthTime
| AuthStaffTime
| AuthAllocationTime

View File

@ -7,6 +7,7 @@ import Model.Types.TH.PathPiece
data SystemFunction
= SystemExamOffice
| SystemFaculty
| SystemStudent
deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic, Typeable)
deriving anyclass (Universe, Finite, Hashable, NFData)