diff options
| author | Joey Hess <joey@kitenet.net> | 2014-11-23 14:41:09 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-11-23 14:41:09 -0400 |
| commit | ac41f8b07b45b1855b1c10665757691a56b08353 (patch) | |
| tree | d446f81a4068ca594abd881c2b055ad2f8662a12 /src/Propellor/Property/User.hs | |
| parent | 1b34f23414b574105ddfdf36fbeb86aa115a0e2e (diff) | |
| parent | 3c952a0de9d228eafe6e208007be7d2e018d68b8 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property/User.hs')
| -rw-r--r-- | src/Propellor/Property/User.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Propellor/Property/User.hs b/src/Propellor/Property/User.hs index f9c400a8..6a51703a 100644 --- a/src/Propellor/Property/User.hs +++ b/src/Propellor/Property/User.hs @@ -30,7 +30,7 @@ hasSomePassword user context = check ((/= HasPassword) <$> getPasswordStatus use hasPassword :: UserName -> Context -> Property hasPassword user context = withPrivData (Password user) context $ \getpassword -> - property (user ++ " has password") $ + property (user ++ " has password") $ getpassword $ \password -> makeChange $ withHandle StdinHandle createProcessSuccess (proc "chpasswd" []) $ \h -> do @@ -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] |
