diff --git a/messages/uniworx/utils/navigation/menu/de-de-formal.msg b/messages/uniworx/utils/navigation/menu/de-de-formal.msg index 78e095b6d..8bcdf9ec9 100644 --- a/messages/uniworx/utils/navigation/menu/de-de-formal.msg +++ b/messages/uniworx/utils/navigation/menu/de-de-formal.msg @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2022 Gregor Kleen ,Sarah Vaupel ,Steffen Jost ,Steffen Jost ,Winnie Ros +# SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel , Gregor Kleen ,Sarah Vaupel ,Steffen Jost ,Steffen Jost ,Winnie Ros # # SPDX-License-Identifier: AGPL-3.0-or-later @@ -141,8 +141,7 @@ MenuSap: SAP Schnittstelle MenuAvs: AVS Schnittstelle MenuAvsSynchError: AVS Problemübersicht -MenuLdap !ident-ok: LDAP -MenuOAuth2 !ident-ok: OAuth2 +MenuExternalUser: Externe Benutzer MenuApc: Druckerei MenuPrintSend: Manueller Briefversand MenuPrintDownload: Brief herunterladen diff --git a/messages/uniworx/utils/navigation/menu/en-eu.msg b/messages/uniworx/utils/navigation/menu/en-eu.msg index bb085c38e..1b59f781a 100644 --- a/messages/uniworx/utils/navigation/menu/en-eu.msg +++ b/messages/uniworx/utils/navigation/menu/en-eu.msg @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2022 Gregor Kleen ,Sarah Vaupel ,Steffen Jost ,Winnie Ros +# SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel , Gregor Kleen ,Sarah Vaupel ,Steffen Jost ,Winnie Ros # # SPDX-License-Identifier: AGPL-3.0-or-later @@ -141,8 +141,7 @@ MenuSap: SAP Interface MenuAvs: AVS Interface MenuAvsSynchError: AVS Problem Overview -MenuLdap: LDAP -MenuOAuth2: OAuth2 +MenuExternalUser: External users MenuApc: Printing MenuPrintSend: Send Letter MenuPrintDownload: Download Letter diff --git a/routes b/routes index 2376c33af..ec953250d 100644 --- a/routes +++ b/routes @@ -1,4 +1,4 @@ --- SPDX-FileCopyrightText: 2022-2023 Sarah Vaupel , Gregor Kleen ,Sarah Vaupel ,Steffen Jost ,Wolfgang Witt +-- SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel , Gregor Kleen ,Sarah Vaupel ,Steffen Jost ,Wolfgang Witt -- -- SPDX-License-Identifier: AGPL-3.0-or-later @@ -30,8 +30,8 @@ -- !capacity -- course this route is associated with has at least one unit of participant capacity -- !empty -- course this route is associated with has no participants whatsoever -- --- !is-ldap -- user has authentication mode set to LDAP --- !is-pw-hash -- user has authentication mode set to PWHash +-- !is-external -- user can login using external sources +-- !is-internal -- user can login using internal credentials -- -- !materials -- only if course allows all materials to be free (no meaning outside of courses) -- !time -- access depends on time somehow @@ -59,24 +59,23 @@ /users/#CryptoUUIDUser/password UserPasswordR GET POST !selfANDis-pw-hash !/users/functionary-invite/new AdminNewFunctionaryInviteR GET POST !/users/functionary-invite AdminFunctionaryInviteR GET POST -!/users/add AdminUserAddR GET POST -/admin AdminR GET -/admin/test AdminTestR GET POST -/admin/test/pdf AdminTestPdfR GET -/admin/errMsg AdminErrMsgR GET POST -/admin/tokens AdminTokensR GET POST -/admin/crontab AdminCrontabR GET -/admin/crontab/jobs AdminJobsR GET POST -/admin/avs AdminAvsR GET POST -/admin/avs/#CryptoUUIDUser AdminAvsUserR GET -/admin/ldap AdminLdapR GET POST -/admin/oauth2 AdminOAuth2R GET POST -/admin/problems AdminProblemsR GET +!/users/add AdminUserAddR GET POST +/admin AdminR GET +/admin/test AdminTestR GET POST +/admin/test/pdf AdminTestPdfR GET +/admin/errMsg AdminErrMsgR GET POST +/admin/tokens AdminTokensR GET POST +/admin/crontab AdminCrontabR GET +/admin/crontab/jobs AdminJobsR GET POST +/admin/avs AdminAvsR GET POST +/admin/avs/#CryptoUUIDUser AdminAvsUserR GET +/admin/external-user AdminExternalUserR GET POST +/admin/problems AdminProblemsR GET /admin/problems/no-contact ProblemUnreachableR GET /admin/problems/no-avs-id ProblemWithoutAvsId GET /admin/problems/r-without-f ProblemFbutNoR GET -/admin/problems/avs ProblemAvsSynchR GET POST -/admin/problems/avs/errors ProblemAvsErrorR GET +/admin/problems/avs ProblemAvsSynchR GET POST +/admin/problems/avs/errors ProblemAvsErrorR GET /print PrintCenterR GET POST !system-printer /print/acknowledge/#Day/#Int/#Int PrintAckR GET POST !system-printer diff --git a/src/Foundation/Navigation.hs b/src/Foundation/Navigation.hs index 75cb1fdf7..8f3f58467 100644 --- a/src/Foundation/Navigation.hs +++ b/src/Foundation/Navigation.hs @@ -115,8 +115,7 @@ breadcrumb AdminCrontabR = i18nCrumb MsgBreadcrumbAdminCrontab $ Just breadcrumb AdminJobsR = i18nCrumb MsgBreadcrumbAdminJobs $ Just AdminCrontabR breadcrumb AdminAvsR = i18nCrumb MsgMenuAvs $ Just AdminR breadcrumb AdminAvsUserR{} = i18nCrumb MsgAvsPersonInfo $ Just AdminAvsR -breadcrumb AdminLdapR = i18nCrumb MsgMenuLdap $ Just AdminR -breadcrumb AdminOAuth2R = i18nCrumb MsgMenuOAuth2 $ Just AdminR +breadcrumb AdminExternalUserR = i18nCrumb MsgMenuExternalUser $ Just AdminR breadcrumb AdminProblemsR = i18nCrumb MsgProblemsHeading $ Just AdminR breadcrumb ProblemUnreachableR = i18nCrumb MsgProblemsUnreachableHeading $ Just AdminProblemsR breadcrumb ProblemWithoutAvsId = i18nCrumb MsgProblemsNoAvsIdHeading $ Just AdminProblemsR @@ -855,16 +854,8 @@ defaultLinks = fmap catMaybes . mapM runMaybeT $ -- Define the menu items of the , navForceActive = False } , NavLink - { navLabel = MsgMenuLdap - , navRoute = AdminLdapR - , navAccess' = NavAccessTrue - , navType = NavTypeLink { navModal = False } - , navQuick' = mempty - , navForceActive = False - } - , NavLink - { navLabel = MsgMenuOAuth2 - , navRoute = AdminOAuth2R + { navLabel = MsgMenuExternalUser + , navRoute = AdminExternalUserR , navAccess' = NavAccessTrue , navType = NavTypeLink { navModal = False } , navQuick' = mempty diff --git a/src/Handler/Admin.hs b/src/Handler/Admin.hs index a64620899..34811f1fd 100644 --- a/src/Handler/Admin.hs +++ b/src/Handler/Admin.hs @@ -1,4 +1,4 @@ --- SPDX-FileCopyrightText: 2022-2023 Sarah Vaupel , Gregor Kleen , Steffen Jost +-- SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel , Gregor Kleen , Steffen Jost -- -- SPDX-License-Identifier: AGPL-3.0-or-later @@ -30,8 +30,7 @@ import Handler.Admin.ErrorMessage as Handler.Admin import Handler.Admin.Tokens as Handler.Admin import Handler.Admin.Crontab as Handler.Admin import Handler.Admin.Avs as Handler.Admin -import Handler.Admin.Ldap as Handler.Admin -import Handler.Admin.OAuth2 as Handler.Admin +import Handler.Admin.ExternalUser as Handler.Admin getAdminR :: Handler Html diff --git a/src/Handler/Admin/Ldap.hs b/src/Handler/Admin/ExternalUser.hs similarity index 83% rename from src/Handler/Admin/Ldap.hs rename to src/Handler/Admin/ExternalUser.hs index 41c34afc1..1d5d11ab4 100644 --- a/src/Handler/Admin/Ldap.hs +++ b/src/Handler/Admin/ExternalUser.hs @@ -1,10 +1,10 @@ --- SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel , Steffen Jost +-- SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel , David Mosbach , Steffen Jost -- -- SPDX-License-Identifier: AGPL-3.0-or-later -module Handler.Admin.Ldap - ( getAdminLdapR - , postAdminLdapR +module Handler.Admin.ExternalUser + ( getAdminExternalUserR + , postAdminExternalUserR ) where import Import @@ -21,11 +21,10 @@ import qualified Data.Text.Encoding as Text import qualified Ldap.Client as Ldap --- TODO: used for every external source type => rename! -getAdminLdapR, postAdminLdapR :: Handler Html -getAdminLdapR = postAdminLdapR -postAdminLdapR = do - ((presult, pwidget), penctype) <- runFormPost $ identifyForm ("adminLdapLookup"::Text) $ \html -> +getAdminExternalUserR, postAdminExternalUserR :: Handler Html +getAdminExternalUserR = postAdminExternalUserR +postAdminExternalUserR = do + ((presult, pwidget), penctype) <- runFormPost $ identifyForm ("adminExternalUserLookup"::Text) $ \html -> flip (renderAForm FormStandard) html $ areq textField (fslI MsgAdminUserIdent) Nothing let @@ -52,7 +51,7 @@ postAdminLdapR = do mbData <- formResultMaybe presult procFormPerson - ((uresult, uwidget), uenctype) <- runFormPost $ identifyForm ("adminLdapUpsert"::Text) $ \html -> + ((uresult, uwidget), uenctype) <- runFormPost $ identifyForm ("adminExternalUserUpsert"::Text) $ \html -> flip (renderAForm FormStandard) html $ areq textField (fslI MsgAdminUserIdent) Nothing let procFormUpsert :: Text -> Handler (Maybe (Entity User)) procFormUpsert lid = pure <$> runDB (userLookupAndUpsert lid UpsertUserGuessUser) @@ -60,9 +59,9 @@ postAdminLdapR = do mbUpsert <- formResultMaybe uresult procFormUpsert - actionUrl <- fromMaybe AdminLdapR <$> getCurrentRoute - siteLayoutMsg MsgMenuLdap $ do - setTitleI MsgMenuLdap + actionUrl <- fromMaybe AdminExternalUserR <$> getCurrentRoute + siteLayoutMsg MsgMenuExternalUser $ do + setTitleI MsgMenuExternalUser let personForm = wrapForm pwidget def { formAction = Just $ SomeRoute actionUrl , formEncoding = penctype @@ -71,6 +70,4 @@ postAdminLdapR = do { formAction = Just $ SomeRoute actionUrl , formEncoding = uenctype } - -- TODO: use i18nWidgetFile instead if this is to become permanent - $(widgetFile "ldap") - + $(widgetFile "admin/external-user") diff --git a/src/Handler/Admin/OAuth2.hs b/src/Handler/Admin/OAuth2.hs deleted file mode 100644 index 1face989f..000000000 --- a/src/Handler/Admin/OAuth2.hs +++ /dev/null @@ -1,59 +0,0 @@ --- SPDX-FileCopyrightText: 2023-2024 Sarah Vaupel ,David Mosbach --- --- SPDX-License-Identifier: AGPL-3.0-or-later - -module Handler.Admin.OAuth2 - ( getAdminOAuth2R - , postAdminOAuth2R - ) where - -import Import --- import qualified Data.CaseInsensitive as CI -import Data.Aeson.Encode.Pretty (encodePretty) -import qualified Data.Text.Lazy as T -import qualified Data.Text.Lazy.Encoding as T ---import qualified Data.Text.Encoding as Text ---import Foundation.Yesod.Auth (CampusUserConversionException()) -import Handler.Utils - -import Auth.OAuth2 (queryOAuth2User) - - -getAdminOAuth2R, postAdminOAuth2R :: Handler Html -getAdminOAuth2R = postAdminOAuth2R -postAdminOAuth2R = do - ((presult, pwidget), penctype) <- runFormPost $ identifyForm ("adminOAuth2Lookup"::Text) $ \html -> - flip (renderAForm FormStandard) html $ areq textField (fslI MsgAdminUserIdent) Nothing - - let procFormPerson :: Text -> Handler (Maybe T.Text) - procFormPerson lid = do --return . Just $ "Mock reply for id " <> lid - eUserData <- queryOAuth2User @Value lid - case eUserData of - Left e -> throwM e - Right userData -> return . Just . T.decodeUtf8 $ encodePretty userData - mOAuth2Data <- formResultMaybe presult procFormPerson - - --((uresult, uwidget), uenctype) <- runFormPost $ identifyForm ("adminOAuth2Upsert"::Text) $ \html -> - -- flip (renderAForm FormStandard) html $ areq textField (fslI MsgAdminUserIdent) Nothing - - --let procFormUpsert :: Text -> Handler (Maybe (Either CampusUserConversionException (Entity User))) - -- procFormUpsert lid = pure <$> runDB (try $ ldapLookupAndUpsert lid) - --mbLdapUpsert <- formResultMaybe uresult procFormUpsert - - - actionUrl <- fromMaybe AdminOAuth2R <$> getCurrentRoute - siteLayoutMsg MsgMenuOAuth2 $ do - setTitleI MsgMenuOAuth2 - let personForm = wrapForm pwidget def - { formAction = Just $ SomeRoute actionUrl - , formEncoding = penctype - } - --upsertForm = wrapForm uwidget def - -- { formAction = Just $ SomeRoute actionUrl - -- , formEncoding = uenctype - -- } - --presentUtf8 lv = Text.intercalate ", " (either tshow id . Text.decodeUtf8' <$> lv) - --presentLatin1 lv = Text.intercalate ", " ( Text.decodeLatin1 <$> lv) - - -- TODO: use i18nWidgetFile instead if this is to become permanent - $(widgetFile "oauth2") diff --git a/templates/ldap.hamlet b/templates/admin/external-user.hamlet similarity index 100% rename from templates/ldap.hamlet rename to templates/admin/external-user.hamlet diff --git a/templates/oauth2.hamlet b/templates/oauth2.hamlet deleted file mode 100644 index 90711a799..000000000 --- a/templates/oauth2.hamlet +++ /dev/null @@ -1,19 +0,0 @@ -$newline never - -$# SPDX-FileCopyrightText: 2023 David Mosbach -$# -$# SPDX-License-Identifier: AGPL-3.0-or-later - -
-

- OAuth2 User Search: - ^{personForm} - $maybe answers <- mOAuth2Data -

- Antwort: # -
-
-
-              #{answers}
-          
-