chore(ldap): remove deprecated code
This commit is contained in:
parent
a5d5d8dbd6
commit
2fb4dce95f
@ -12,7 +12,6 @@ import Foundation.Types
|
|||||||
import Foundation.I18n
|
import Foundation.I18n
|
||||||
|
|
||||||
import Handler.Utils.Profile
|
import Handler.Utils.Profile
|
||||||
-- import Handler.Utils.SchoolLdap -- Delete this module?
|
|
||||||
import Handler.Utils.LdapSystemFunctions
|
import Handler.Utils.LdapSystemFunctions
|
||||||
import Handler.Utils.Memcached
|
import Handler.Utils.Memcached
|
||||||
import Foundation.Authorization (AuthorizationCacheKey(..))
|
import Foundation.Authorization (AuthorizationCacheKey(..))
|
||||||
|
|||||||
@ -1,31 +0,0 @@
|
|||||||
module Handler.Utils.SchoolLdap
|
|
||||||
( parseLdapSchools
|
|
||||||
) where
|
|
||||||
|
|
||||||
import Import.NoFoundation hiding (try, (<|>), choice)
|
|
||||||
|
|
||||||
import Text.Parsec
|
|
||||||
import Text.Parsec.Text
|
|
||||||
|
|
||||||
import qualified Data.CaseInsensitive as CI
|
|
||||||
|
|
||||||
import qualified Data.Set as Set
|
|
||||||
|
|
||||||
{- PROBALY DEPRECATED -}
|
|
||||||
parseLdapSchools :: Text -> Either ParseError (Set (CI Text))
|
|
||||||
parseLdapSchools = parse pLdapSchools ""
|
|
||||||
|
|
||||||
pLdapSchools :: Parser (Set (CI Text))
|
|
||||||
pLdapSchools = Set.fromList . map CI.mk <$> pSegment `sepBy` char ','
|
|
||||||
|
|
||||||
pSegment :: Parser Text
|
|
||||||
pSegment = do
|
|
||||||
let
|
|
||||||
fragStart = flip label "fragment start" $ do
|
|
||||||
void . choice . map (try . string) $ sortOn Down
|
|
||||||
[ "l", "st", "o", "ou", "c", "street", "dc" ]
|
|
||||||
void $ char '='
|
|
||||||
|
|
||||||
fragStart
|
|
||||||
pack <$> manyTill anyChar (try (lookAhead $ char ',' >> fragStart) <|> eof)
|
|
||||||
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
module Handler.Utils.SchoolLdapSpec where
|
|
||||||
|
|
||||||
import TestImport
|
|
||||||
|
|
||||||
import Handler.Utils.SchoolLdap
|
|
||||||
|
|
||||||
import qualified Data.Set as Set
|
|
||||||
|
|
||||||
spec :: Spec
|
|
||||||
spec = describe "ldap school extraction" $ do
|
|
||||||
it "works for some examples" . example $ do
|
|
||||||
let matches str frags = parseLdapSchools str `shouldBe` Right (Set.fromList frags)
|
|
||||||
|
|
||||||
"ou=Fakultät für Mathematik, Informatik und Statistik (16_Fak_Mathe_Info_Stat),o=uni-muenchen,c=de" `matches` ["Fakultät für Mathematik, Informatik und Statistik (16_Fak_Mathe_Info_Stat)", "uni-muenchen", "de"]
|
|
||||||
"ou=Katholisch-Theologische Fakultät (01 Fak. Kathol. Theologie),o=uni-muenchen,c=de" `matches` ["Katholisch-Theologische Fakultät (01 Fak. Kathol. Theologie)", "uni-muenchen", "de"]
|
|
||||||
"ou=C4-Professur für Informatik (1603 C4 Hofmann),ou=Department Institut für Informatik (1603 Dept. Informatik),ou=Fakultät für Mathematik, Informatik und Statistik (16 Fak. Mathe Info. Stat.),o=uni-muenchen,c=de" `matches` ["C4-Professur für Informatik (1603 C4 Hofmann)", "Department Institut für Informatik (1603 Dept. Informatik)", "Fakultät für Mathematik, Informatik und Statistik (16 Fak. Mathe Info. Stat.)", "uni-muenchen", "de"]
|
|
||||||
"ou=Department Mathematisches Institut (1601_Dept_Mathemat_Inst),ou=Fakultät für Mathematik, Informatik und Statistik (16_Fak_Mathe_Info_Stat),o=uni-muenchen,c=de" `matches` ["Department Mathematisches Institut (1601_Dept_Mathemat_Inst)", "Fakultät für Mathematik, Informatik und Statistik (16_Fak_Mathe_Info_Stat)", "uni-muenchen", "de"]
|
|
||||||
"ou=Fakultät für Physik (17_Fakultät_Physik),o=uni-muenchen,c=de" `matches` ["Fakultät für Physik (17_Fakultät_Physik)", "uni-muenchen", "de"]
|
|
||||||
Reference in New Issue
Block a user