implements upload on server

actually move extracted dir to resource location
This commit is contained in:
Keagan McClelland
2022-05-20 17:44:25 -06:00
parent d2aee89cda
commit 87b5a6e4a1
6 changed files with 90 additions and 6 deletions

View File

@@ -36,6 +36,7 @@ import Control.Monad.Reader.Has ( Has(extract, update) )
import Crypto.Hash ( SHA256(SHA256)
, hashWith
)
import Data.Set ( member )
import Data.String.Interpolate.IsString
( i )
import qualified Data.Text as T
@@ -189,6 +190,13 @@ instance Yesod RegistryCtx where
LevelError -> Red
LevelOther _ -> White
isAuthorized :: Route RegistryCtx -> Bool -> Handler AuthResult
isAuthorized route _
| "admin" `member` routeAttrs route = do
hasAuthId <- isJust <$> maybeAuthId
pure $ if hasAuthId then Authorized else Unauthorized "This feature is for admins only"
| otherwise = pure Authorized
-- How to run database actions.
instance YesodPersist RegistryCtx where