-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | The LDAP Data Interchange Format (LDIF) parser -- -- LDIF files parser implementation using Parsec and based on RFC 2849 - -- The LDAP Data Interchange Format (LDIF). -- -- Current implementation is unfinished and need to be enhanced for -- base64 encoded values and various DN escaping. -- -- It includes following tool: -- -- @package ldif @version 0.0.8 -- | LDIF related types module Text.LDIF.Types -- | Represents LDIF structure, it can be either simply LDIF data dump or | -- changes LDIF with LDAP operations data LDIF LDIF :: Maybe String -> [LDIFRecord] -> LDIF lcVersion :: LDIF -> Maybe String lcEntries :: LDIF -> [LDIFRecord] -- | Represents one data record within LDIF file with DN and content | -- Represents one change record within LDIF file with DN and content data LDIFRecord ContentRecord :: DN -> [AttrValue] -> LDIFRecord reDN :: LDIFRecord -> DN coAttrVals :: LDIFRecord -> [AttrValue] ChangeRecord :: DN -> Change -> LDIFRecord reDN :: LDIFRecord -> DN chOp :: LDIFRecord -> Change -- | Represents one LDAP operation within changes LDIF data Change ChangeAdd :: [AttrValue] -> Change chAttrVals :: Change -> [AttrValue] ChangeDelete :: Change ChangeModify :: [Modify] -> Change chMods :: Change -> [Modify] ChangeModDN :: Change -- | Represents ChangeModify operations upon one entry within given DN data Modify ModAdd :: Attribute -> [Value] -> Modify modAttr :: Modify -> Attribute modAttrVals :: Modify -> [Value] ModDelete :: Attribute -> [Value] -> Modify modAttr :: Modify -> Attribute modAttrVals :: Modify -> [Value] ModReplace :: Attribute -> [Value] -> Modify modAttr :: Modify -> Attribute modAttrVals :: Modify -> [Value] -- | Represents Distinguished Name (DN) data DN DN :: [AttrValue] -> DN dnAttrVals :: DN -> [AttrValue] DNi :: [AttrValue] -> DN dnAttrVals :: DN -> [AttrValue] -- | Type of LDIF Files (Content, Changes) data LDIFType LDIFContentType :: LDIFType LDIFChangesType :: LDIFType LDIFMixedType :: LDIFType newtype Attribute Attribute :: String -> Attribute type Value = String type AttrValue = (Attribute, Value) instance Show DN instance Show Modify instance Eq Modify instance Show Change instance Eq Change instance Show LDIFRecord instance Eq LDIFRecord instance Show LDIF instance Eq LDIF instance Eq LDIFType instance Show Attribute instance Eq DN instance Show LDIFType instance Ord Attribute instance Eq Attribute module Text.LDIF.Parser -- | Parse string as LDIF content and return LDIF or ParseError parseLDIFStr :: String -> Either ParseError LDIF parseLDIFStrAs :: Maybe LDIFType -> String -> Either ParseError LDIF -- | Read and parse provided file and return LDIF or ParseError parseLDIFFile :: String -> IO (Either ParseError LDIF) -- | Parse string as DN and return DN type or ParseError parseDNStr :: String -> Either ParseError DN -- | LDIF serializers module Text.LDIF.Printer -- | Serialize LDIF in LDIF Format ldif2str :: LDIF -> String -- | Serialize DN to LDIF Format dn2str :: DN -> String -- | Serialize Content Record in LDIF Format record2str :: LDIFRecord -> String -- | LDIF related operations module Text.LDIF.Utils -- | Find all Contents with given DN findRecordsByDN :: LDIF -> DN -> [LDIFRecord] -- | Find first Content with given DN findRecordByDN :: LDIF -> DN -> Maybe LDIFRecord -- | Check if the dn1 is prefix of dn2 isDNPrefixOf :: DN -> DN -> Bool sizeOfDN :: DN -> Int takeDNPrefix :: DN -> Int -> DN leafOfDN :: DN -> AttrValue rootOfDN :: DN -> AttrValue -- | Find fist Attribute within attributes pairs list lookupAttr :: String -> [AttrValue] -> Maybe Value -- | Filter Attribute Value list according Attribute name filterAttr :: String -> [AttrValue] -> [AttrValue] -- | Change record without any impact isDummyRecord :: LDIFRecord -> Bool ldif2tree :: LDIF -> Tree LDIFRecord getLDIFType :: LDIF -> LDIFType isContentRecord :: LDIFRecord -> Bool isChangeRecord :: LDIFRecord -> Bool dn2dnI :: DN -> DN ldif2ldifI :: LDIF -> LDIF module Text.LDIF.Diff -- | Create Change LDIF between to LDIF contents. If any | of input -- argument is not LDIFContent it returns Nothing. | If there is not -- difference the Change LDIF with empty | change list is returned. | | -- Unsing following strategy: | 1. Iterate over L1 DN's and Modify / -- Remove Content | 2. Iterate over L2 and Add Content not in L1 diffLDIF :: LDIF -> LDIF -> Either String LDIF -- | Diff two AttrVal Records if any of provided. | Implementation uses -- inefficient algorithm for large count of attributes within -- ContentRecord. diffRecord :: LDIFRecord -> LDIFRecord -> Maybe LDIFRecord module Text.LDIF.Apply -- | Apply one LDIF to another LDIF. The destination LDIF has | to be -- Content LDIF applyLDIF :: LDIF -> LDIF -> LDIF module Text.LDIF