Optimization when auth role coincides with anon role

No need to set/reset role because it is already correct
This commit is contained in:
Joe Nelson
2014-12-29 09:39:13 -08:00
parent 24f70f5bdf
commit 2c635cfde8
4 changed files with 12 additions and 22 deletions
+2 -1
View File
@@ -49,13 +49,14 @@ main = do
. gzip def . cors corsPolicy
. staticPolicy (only [("favicon.ico", "static/favicon.ico")])
anonRole = cs $ configAnonRole conf
currRole = cs $ configDbUser conf
H.session pgSettings sessSettings $ H.sessionUnlifter >>= \unlift ->
liftIO $ runSettings appSettings $ middle $ \req respond -> do
body <- strictRequestBody req
respond =<< catchJust isSqlError
(unlift $ H.tx Nothing
$ authenticated anonRole (app body) req)
$ authenticated currRole anonRole (app body) req)
(return . sqlError)
where