From 1f2e453d0c9f8412b9032cb4e655713ecdcf1fa3 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Mon, 26 May 2025 04:43:38 -0400 Subject: web: Refactor major style --- fig-web/src/Fig/Web/LDAP.hs | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 fig-web/src/Fig/Web/LDAP.hs (limited to 'fig-web/src/Fig/Web/LDAP.hs') diff --git a/fig-web/src/Fig/Web/LDAP.hs b/fig-web/src/Fig/Web/LDAP.hs deleted file mode 100644 index 07c87d9..0000000 --- a/fig-web/src/Fig/Web/LDAP.hs +++ /dev/null @@ -1,43 +0,0 @@ -module Fig.Web.LDAP where - -import Fig.Prelude - -import System.Exit (ExitCode(..)) -import qualified System.Process as Proc - -import qualified Data.UUID as UUID -import qualified Data.UUID.V4 as UUID -import qualified Data.Text as Text - -import Fig.Web.Utils - --- | Reset the password in LDAP for the specified user (creating the user if necessary) -resetUserPassword :: MonadIO m => Config -> Text -> Text -> m (Maybe Text) -resetUserPassword cfg user uid = do - let login = Text.toLower user - password <- UUID.toText <$> liftIO UUID.nextRandom - (exitCode, out0, err0) <- liftIO . flip Proc.readCreateProcessWithExitCode "" - . Proc.proc cfg.lldapCli $ unpack <$> - [ "-H", cfg.lldapHost - , "-D", cfg.lldapUser - , "-w", cfg.lldapPassword - , "user", "add", login, uid <> "@users.colonq.computer" - , "-p", password - , "-f", uid - ] - (_, out1, err1) <- liftIO . flip Proc.readCreateProcessWithExitCode "" - . Proc.proc cfg.lldapCli $ unpack <$> - [ "-H", cfg.lldapHost - , "-D", cfg.lldapUser - , "-w", cfg.lldapPassword - , "user", "group", "add", login, "fig_users" - ] - case exitCode of - ExitSuccess -> pure $ Just password - ExitFailure _ -> do - log . pack $ mconcat - [ "LDAP CLI error:\n" - , out0, err0 - , out1, err1 - ] - pure Nothing -- cgit v1.2.3