Join script should rule out retired usernames
[bpt/portal.git] / chooseDomain.sml
CommitLineData
eafe3d52
AC
1structure ChooseDomain :> CHOOSE_DOMAIN = struct
2
3fun domains user =
4 let
5 val proc = Unix.execute ("/bin/sh", ["-c", "DOMTOOL_USER=hcoop /usr/local/bin/domtool-admin perms " ^ user])
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 ["domain", domains] => String.tokens Char.isSpace domains
14 | _ => loop ()
15 in
16 loop ()
17 before ignore (Unix.reap proc)
18 end
19
20fun yourDomain {user, domain} = List.exists (fn x => x = domain) (domains user)
21
22end