chore(admin): oauth2 admin form identifiers

This commit is contained in:
David Mosbach 2023-12-18 00:56:50 +00:00
parent 5c4f742745
commit ce8aa849f8

View File

@ -15,34 +15,33 @@ import Import
getAdminOAuth2R, postAdminOAuth2R :: Handler Html
getAdminOAuth2R = postAdminOAuth2R
postAdminOAuth2R = error "postAdminOAuth2R not yet implemented"
-- ((presult, pwidget), penctype) <- runFormPost $ identifyForm ("adminLdapLookup"::Text) $ \html ->
-- flip (renderAForm FormStandard) html $ areq textField (fslI MsgAdminUserIdent) Nothing
--
-- let procFormPerson :: Text -> Handler (Maybe ())
-- procFormPerson lid = error "TODO"
--
--
-- ((uresult, uwidget), uenctype) <- runFormPost $ identifyForm ("adminLdapUpsert"::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 AdminLdapR <$> getCurrentRoute
-- siteLayoutMsg MsgMenuLdap $ do
-- setTitleI MsgMenuLdap
-- 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 "ldap")
postAdminOAuth2R =
((presult, pwidget), penctype) <- runFormPost $ identifyForm ("adminOAuth2Lookup"::Text) $ \html ->
flip (renderAForm FormStandard) html $ areq textField (fslI MsgAdminUserIdent) Nothing
let procFormPerson :: Text -> Handler (Maybe ())
procFormPerson lid = error "TODO"
((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 AdminLdapR <$> getCurrentRoute
siteLayoutMsg MsgMenuLdap $ do
setTitleI MsgMenuLdap
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")