All solutions are visible now

All the data (except for the repo URL and dev outputs) could be
inferred, anyway. So it would not make much sense to hide it.
This commit is contained in:
Filip Gralinski 2021-08-21 15:15:10 +02:00
parent 9677c32cd5
commit 9f4942a657
4 changed files with 7 additions and 8 deletions

View File

@ -181,7 +181,7 @@ instance Yesod App where
isAuthorized UserInfoR _ = return Authorized isAuthorized UserInfoR _ = return Authorized
isAuthorized (ChallengeSubmissionJsonR _) _ = return Authorized isAuthorized (ChallengeSubmissionJsonR _) _ = return Authorized
isAuthorized (ChallengeReadmeInMarkdownR _) _ = regularAuthorization isAuthorized (ChallengeReadmeInMarkdownR _) _ = regularAuthorization
isAuthorized (QueryJsonR _) _ = return Authorized isAuthorized (QueryJsonR _) _ = regularAuthorization
isAuthorized ListTagsJsonR _ = regularAuthorization isAuthorized ListTagsJsonR _ = regularAuthorization
isAuthorized (ChallengeGraphDataR _) _ = regularAuthorization isAuthorized (ChallengeGraphDataR _) _ = regularAuthorization

View File

@ -151,8 +151,7 @@ findSubmissions :: Text -> Handler [(FullSubmissionInfo, [SHA1])]
findSubmissions sha1Prefix = do findSubmissions sha1Prefix = do
mauthId <- maybeAuth mauthId <- maybeAuth
allSubmissions <- runDB $ rawCommitQuery sha1Prefix allSubmissions <- runDB $ rawCommitQuery sha1Prefix
submissions <- filterM (\sub -> runDB $ checkWhetherVisible (entityVal sub) (entityKey <$> mauthId)) allSubmissions justSubmissions' <- mapM getFullInfo allSubmissions
justSubmissions' <- mapM getFullInfo submissions
let justSubmissions = map (\s -> (s, [])) justSubmissions' let justSubmissions = map (\s -> (s, [])) justSubmissions'
outs <- runDB $ rawOutQuery sha1Prefix outs <- runDB $ rawOutQuery sha1Prefix
@ -378,7 +377,7 @@ fetchViewVariantData variantId = do
(submissionChallenge theSubmission) (submissionChallenge theSubmission)
let tests = sortBy (flip testComparator) tests' let tests = sortBy (flip testComparator) tests'
isViewable <- runDB $ checkWhetherVisible theSubmission (entityKey <$> mauthId) let isViewable = True
if isViewable if isViewable
then then
@ -508,7 +507,7 @@ getOut :: Maybe UserId -> TableEntry -> WidgetFor App (Maybe (FilePath, FilePath
getOut mauthId entry = do getOut mauthId entry = do
let variant = variantName $ entityVal $ tableEntryVariant entry let variant = variantName $ entityVal $ tableEntryVariant entry
isViewable <- handlerToWidget $ runDB $ checkWhetherVisible (entityVal $ tableEntrySubmission entry) mauthId let isViewable = True
if isViewable if isViewable
then then
do do

View File

@ -1325,7 +1325,7 @@ convertTableEntryToView tests entry = do
mUserId <- maybeAuthPossiblyByToken mUserId <- maybeAuthPossiblyByToken
isReevaluable <- runDB $ canBeReevaluated $ entityKey $ tableEntrySubmission entry isReevaluable <- runDB $ canBeReevaluated $ entityKey $ tableEntrySubmission entry
isVisible <- runDB $ checkWhetherVisible submission (entityKey <$> mUserId) let isVisible = True
return $ SubmissionView { return $ SubmissionView {
submissionViewId = fromSqlKey $ entityKey $ tableEntrySubmission entry, submissionViewId = fromSqlKey $ entityKey $ tableEntrySubmission entry,

View File

@ -282,7 +282,7 @@ extractInt ((PersistInt64 x):_) = x
statusCellWidget :: Text -> RepoScheme -> Repo -> (SubmissionId, Submission, VariantId, Variant, Maybe UserId) -> WidgetFor App () statusCellWidget :: Text -> RepoScheme -> Repo -> (SubmissionId, Submission, VariantId, Variant, Maybe UserId) -> WidgetFor App ()
statusCellWidget challengeName repoScheme challengeRepo (submissionId, submission, variantId, _, mauthId) = do statusCellWidget challengeName repoScheme challengeRepo (submissionId, submission, variantId, _, mauthId) = do
isReevaluable <- handlerToWidget $ runDB $ canBeReevaluated submissionId isReevaluable <- handlerToWidget $ runDB $ canBeReevaluated submissionId
isVisible <- handlerToWidget $ runDB $ checkWhetherVisible submission mauthId let isVisible = True
$(widgetFile "submission-status") $(widgetFile "submission-status")
where commitHash = fromSHA1ToText $ submissionCommit submission where commitHash = fromSHA1ToText $ submissionCommit submission
isPublic = submissionIsPublic submission isPublic = submissionIsPublic submission
@ -405,7 +405,7 @@ toLeaderboardEntry challengeId tests ss = do
mUserId <- maybeAuthPossiblyByToken mUserId <- maybeAuthPossiblyByToken
isReevaluable <- runDB $ canBeReevaluated $ entityKey $ tableEntrySubmission bestOne isReevaluable <- runDB $ canBeReevaluated $ entityKey $ tableEntrySubmission bestOne
isVisible <- runDB $ checkWhetherVisible submission (entityKey <$> mUserId) let isVisible = True
mTeam <- case submissionTeam $ entityVal bestSubmission of mTeam <- case submissionTeam $ entityVal bestSubmission of
Just teamId -> do Just teamId -> do