Remove auth error messages

This commit is contained in:
fr33domlover 2016-05-25 21:58:22 +00:00
parent ec49a4c424
commit 29cf2f853b

View file

@ -118,25 +118,20 @@ instance Yesod App where
-- Who can access which pages. -- Who can access which pages.
isAuthorized r w = case (r, w) of isAuthorized r w = case (r, w) of
(GroupsR , True) -> loggedIn (GroupsR , True) -> loggedIn
(GroupNewR , _) -> loggedIn (GroupNewR , _) -> loggedIn
(ProjectNewR user , _) -> (ProjectNewR user , _) -> loggedInAs user
loggedInAs user "You cant create projects for other users" (RepoNewR user , _) -> loggedInAs user
(RepoNewR user , _) -> (KeysR , _) -> loggedIn
loggedInAs user "You cant create repos for other users" (KeyR _key , _) -> loggedIn
(KeysR , _) -> loggedIn (KeyNewR , _) -> loggedIn
(KeyR _key , _) -> loggedIn (RepoR shar _ , True) -> loggedInAs shar
(KeyNewR , _) -> loggedIn (TicketNewR _ _ , _) -> loggedIn
(RepoR shar _ , True) -> (TicketR user _ _ , True) -> loggedInAs user
loggedInAs shar "You cant modify repos for other users" (TicketEditR user _ _ , _) -> loggedInAs user
(TicketNewR _ _ , _) -> loggedIn
(TicketR user _ _ , True) ->
loggedInAs user "Only project members can modify this ticket"
(TicketEditR user _ _ , _) ->
loggedInAs user "Only project members can modify this ticket"
(TicketDiscussionR _ _ _ , True) -> loggedIn (TicketDiscussionR _ _ _ , True) -> loggedIn
(TicketTopReplyR _ _ _ , _) -> loggedIn (TicketTopReplyR _ _ _ , _) -> loggedIn
(TicketReplyR _ _ _ _ , _) -> loggedIn (TicketReplyR _ _ _ _ , _) -> loggedIn
_ -> return Authorized _ -> return Authorized
-- This function creates static content files in the static folder -- This function creates static content files in the static folder
-- and names them based on a hash of their content. This allows -- and names them based on a hash of their content. This allows
@ -229,8 +224,8 @@ loggedIn = do
Nothing -> return AuthenticationRequired Nothing -> return AuthenticationRequired
Just _pid -> return Authorized Just _pid -> return Authorized
loggedInAs :: ShrIdent -> Text -> Handler AuthResult loggedInAs :: ShrIdent -> Handler AuthResult
loggedInAs ident msg = do loggedInAs ident = do
mp <- maybeAuth mp <- maybeAuth
case mp of case mp of
Nothing -> return AuthenticationRequired Nothing -> return AuthenticationRequired
@ -243,9 +238,9 @@ loggedInAs ident msg = do
personLogin person <> personLogin person <>
" specified a nonexistent sharer ID" " specified a nonexistent sharer ID"
Just sharer -> Just sharer ->
if ident == sharerIdent sharer return $ if ident == sharerIdent sharer
then return Authorized then Authorized
else return $ Unauthorized msg else Unauthorized "No access to this operation"
instance YesodBreadcrumbs App where instance YesodBreadcrumbs App where
breadcrumb route = return $ case route of breadcrumb route = return $ case route of