Source file sihl_authz.ml
1
2
3
4
5
6
7
8
9
10
type guard = bool * string
let authorize (can, msg) = if can then Ok () else Error msg
let any guards msg =
let can =
guards |> List.map authorize |> List.find_opt Result.is_ok |> Option.is_some
in
authorize (can, msg)
;;