mirror of
https://github.com/Start9Labs/registry.git
synced 2026-04-01 20:44:15 +00:00
implements upload on server
actually move extracted dir to resource location
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user