Remove auth error messages
This commit is contained in:
parent
ec49a4c424
commit
29cf2f853b
1 changed files with 18 additions and 23 deletions
|
@ -119,20 +119,15 @@ instance Yesod App where
|
||||||
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 can’t create projects for other users"
|
(RepoNewR user , _) -> loggedInAs user
|
||||||
(RepoNewR user , _) ->
|
|
||||||
loggedInAs user "You can’t create repos for other users"
|
|
||||||
(KeysR , _) -> loggedIn
|
(KeysR , _) -> loggedIn
|
||||||
(KeyR _key , _) -> loggedIn
|
(KeyR _key , _) -> loggedIn
|
||||||
(KeyNewR , _) -> loggedIn
|
(KeyNewR , _) -> loggedIn
|
||||||
(RepoR shar _ , True) ->
|
(RepoR shar _ , True) -> loggedInAs shar
|
||||||
loggedInAs shar "You can’t modify repos for other users"
|
|
||||||
(TicketNewR _ _ , _) -> loggedIn
|
(TicketNewR _ _ , _) -> loggedIn
|
||||||
(TicketR user _ _ , True) ->
|
(TicketR user _ _ , True) -> loggedInAs user
|
||||||
loggedInAs user "Only project members can modify this ticket"
|
(TicketEditR user _ _ , _) -> loggedInAs user
|
||||||
(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
|
||||||
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue