summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/User.hs
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2014-07-06 18:23:54 -0400
committerJoey Hess <joey@kitenet.net>2014-07-06 18:23:54 -0400
commit40d559fbbeb35f76927366948625bb58f1c72209 (patch)
tree35017feaeefe61548f3496cfd0016fe7ab55d68f /src/Propellor/Property/User.hs
parente5dcc8e17668b3994fc8de1d53c7e48659c08aee (diff)
parent32bb2d50a176ebb9070288a75bf86fd1c92ef0be (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property/User.hs')
-rw-r--r--src/Propellor/Property/User.hs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/Propellor/Property/User.hs b/src/Propellor/Property/User.hs
index eef2a57e..f9c400a8 100644
--- a/src/Propellor/Property/User.hs
+++ b/src/Propellor/Property/User.hs
@@ -24,17 +24,18 @@ nuked user _ = check (isJust <$> catchMaybeIO (homedir user)) $ cmdProperty "use
-- | Only ensures that the user has some password set. It may or may
-- not be the password from the PrivData.
-hasSomePassword :: UserName -> Property
-hasSomePassword user = check ((/= HasPassword) <$> getPasswordStatus user) $
- hasPassword user
+hasSomePassword :: UserName -> Context -> Property
+hasSomePassword user context = check ((/= HasPassword) <$> getPasswordStatus user) $
+ hasPassword user context
-hasPassword :: UserName -> Property
-hasPassword user = property (user ++ " has password") $
- withPrivData (Password user) $ \password -> makeChange $
- withHandle StdinHandle createProcessSuccess
- (proc "chpasswd" []) $ \h -> do
- hPutStrLn h $ user ++ ":" ++ password
- hClose h
+hasPassword :: UserName -> Context -> Property
+hasPassword user context = withPrivData (Password user) context $ \getpassword ->
+ property (user ++ " has password") $
+ getpassword $ \password -> makeChange $
+ withHandle StdinHandle createProcessSuccess
+ (proc "chpasswd" []) $ \h -> do
+ hPutStrLn h $ user ++ ":" ++ password
+ hClose h
lockedPassword :: UserName -> Property
lockedPassword user = check (not <$> isLockedPassword user) $ cmdProperty "passwd"