fix(allocations): don't show all allocation information to lecturers
This commit is contained in:
parent
912afba075
commit
ad6c503ef5
@ -25,13 +25,14 @@ postCAEditR tid ssh csh cID = do
|
||||
-> hasWriteAccessTo $ SchoolR allocationSchool SchoolEditR
|
||||
Nothing
|
||||
-> hasWriteAccessTo $ SchoolR courseSchool SchoolEditR
|
||||
let afmApplicant = uid == courseApplicationUser || isAdmin
|
||||
afmLecturer <- hasWriteAccessTo $ CourseR courseTerm courseSchool courseShorthand CEditR
|
||||
afmApplicantEdit <- hasWriteAccessTo $ CApplicationR tid ssh csh cID CAEditR -- TODO: Wrong.
|
||||
mayEdit <- hasWriteAccessTo $ CApplicationR tid ssh csh cID CAEditR
|
||||
courseCID <- encrypt cid :: Handler CryptoUUIDCourse
|
||||
|
||||
let afMode = ApplicationFormMode
|
||||
{ afmApplicant = uid == courseApplicationUser || isAdmin
|
||||
, afmApplicantEdit
|
||||
{ afmApplicant
|
||||
, afmApplicantEdit = afmApplicant && mayEdit
|
||||
, afmLecturer
|
||||
}
|
||||
|
||||
|
||||
@ -221,6 +221,11 @@ postCApplicationsR tid ssh csh = do
|
||||
participantLink uid = do
|
||||
cID <- encrypt uid
|
||||
return . SomeRoute . CourseR tid ssh csh $ CUserR cID
|
||||
|
||||
applicationLink :: MonadCrypto m => CourseApplicationId -> m (SomeRoute UniWorX)
|
||||
applicationLink appId = do
|
||||
cID <- encrypt appId
|
||||
return . SomeRoute $ CApplicationR tid ssh csh cID CAEditR
|
||||
|
||||
dbtSQLQuery :: CourseApplicationsTableExpr -> E.SqlQuery _
|
||||
dbtSQLQuery = runReaderT $ do
|
||||
@ -256,7 +261,7 @@ postCApplicationsR tid ssh csh = do
|
||||
dbtColonnade :: Colonnade Sortable _ _
|
||||
dbtColonnade = mconcat
|
||||
[ emptyOpticColonnade (resultAllocation . _entityVal) $ \l -> anchorColonnade (views l allocationLink) $ colAllocationShorthand (l . _allocationShorthand)
|
||||
, colApplicationId (resultCourseApplication . _entityKey)
|
||||
, anchorColonnadeM (views (resultCourseApplication . _entityKey) applicationLink) $ colApplicationId (resultCourseApplication . _entityKey)
|
||||
, anchorColonnadeM (views (resultUser . _entityKey) participantLink) $ colUserDisplayName (resultUser . _entityVal . $(multifocusL 2) _userDisplayName _userSurname)
|
||||
, colUserMatriculation (resultUser . _entityVal . _userMatrikelnummer)
|
||||
, emptyOpticColonnade (resultStudyTerms . _entityVal) colStudyTerms
|
||||
|
||||
Loading…
Reference in New Issue
Block a user