payment: note that Stripe has instituted an additional 1% fee for non-US cards
[hcoop/portal.git] / domtool.sml
CommitLineData
5a2cf523
CE
1structure Domtool :> DOMTOOL = struct
2
3fun perms class user =
4 let
811dc1e5 5 val proc = Unix.execute ("/bin/sh", ["-c", "DOMTOOL_USER=hcoop.daemon /usr/local/bin/domtool-admin perms " ^ user])
5a2cf523
CE
6 val inf = Unix.textInstreamOf proc
7
8 fun loop () =
9 case TextIO.inputLine inf of
10 NONE => []
11 | SOME line =>
12 case String.tokens (fn ch => ch = #":") line of
13 [class', permissions] => if class' = class then String.tokens Char.isSpace permissions else loop ()
14 | _ => loop ()
15 in
16 loop ()
17 before ignore (Unix.reap proc)
18 end
19
20fun hasPerm class user value =
21 List.exists (fn x => x = value) (perms class user)
22
23end