User: hasGroup

Signed-off-by: Félix Sipma <felix.sipma@no-log.org>
This commit is contained in:
Félix Sipma 2014-11-23 18:25:39 +01:00 committed by Joey Hess
parent feae1912ab
commit f4e06ae778
1 changed files with 10 additions and 1 deletions

View File

@ -60,3 +60,12 @@ isLockedPassword user = (== LockedPassword) <$> getPasswordStatus user
homedir :: UserName -> IO FilePath
homedir user = homeDirectory <$> getUserEntryForName user
hasGroup :: UserName -> GroupName -> Property
hasGroup user group' = check test $ cmdProperty "adduser"
[ user
, group'
]
`describe` unwords ["user", user, "in group", group']
where
test = not <$> elem group' <$> words <$> readProcess "groups" [user]