Safe Haskell | Unsafe |
---|---|
Language | Haskell2010 |
Simplified access to Action
with guarded exits.
- newtype UnsafeAction e s a = UnsafeAction {
- fromUnsafeAction :: ReaderT ActionState (EitherT (ThentosError e) (StateT s IO)) a
- assertAuth :: Action e s Bool -> Action e s ()
- hasAgent :: Agent -> Action e s Bool
- hasUserId :: UserId -> Action e s Bool
- hasServiceId :: ServiceId -> Action e s Bool
- hasRole :: Role -> Action e s Bool
- guardedUnsafeAction :: Action e s Bool -> UnsafeAction e s a -> Action e s a
- unsafeAction :: forall e s a. UnsafeAction e s a -> Action e s a
Documentation
newtype UnsafeAction e s a
Like Action
, but with IO
at the base.
UnsafeAction | |
|
MonadReader ActionState (UnsafeAction e s) | |
MonadState s (UnsafeAction e s) | |
MonadError (ThentosError e) (UnsafeAction e s) | |
Monad (UnsafeAction e s) | |
Functor (UnsafeAction e s) | |
Applicative (UnsafeAction e s) | |
MonadIO (UnsafeAction e s) | |
Generic (UnsafeAction e s a) | |
type Rep (UnsafeAction e s a) |
assertAuth :: Action e s Bool -> Action e s ()
Run boolean authorization predicate. Throw ActionErrorAnyLabel
if the result is False
.
hasServiceId :: ServiceId -> Action e s Bool
guardedUnsafeAction :: Action e s Bool -> UnsafeAction e s a -> Action e s a
Run an UnsafeAction
in a safe Action
with extra authorization checks (performed through
assertAuth
).
unsafeAction :: forall e s a. UnsafeAction e s a -> Action e s a
Run an UnsafeAction
in a safe Action
without extra authorization checks.