fix(ldap): allow punctuation in displaynames
This commit is contained in:
parent
8cdc2b5267
commit
61cfdc8758
@ -19,17 +19,20 @@ validDisplayName :: Maybe UserTitle
|
||||
validDisplayName (fmap Text.strip -> mTitle) (Text.strip -> fName) (Text.strip -> sName) (Text.strip -> dName)
|
||||
= and [ dNameFrags `MultiSet.isSubsetOf` MultiSet.unions [titleFrags, fNameFrags, sNameFrags]
|
||||
, sName `Text.isInfixOf` dName
|
||||
, all ((<= 1) . Text.length) . filter (Text.any Char.isSpace) $ Text.groupBy ((==) `on` Char.isSpace) dName
|
||||
, all ((<= 1) . Text.length) . filter (Text.any isAdd) $ Text.group dName
|
||||
, dNameLetters `Set.isSubsetOf` Set.unions [titleLetters, fNameLetters, sNameLetters, addLetters]
|
||||
]
|
||||
where
|
||||
titleFrags = MultiSet.fromList $ maybe [] Text.words mTitle
|
||||
fNameFrags = MultiSet.fromList $ Text.words fName
|
||||
sNameFrags = MultiSet.fromList $ Text.words sName
|
||||
dNameFrags = MultiSet.fromList $ Text.words dName
|
||||
dNameFrags = MultiSet.fromList $ stripAdd <$> Text.words dName
|
||||
|
||||
titleLetters = Set.fromList $ maybe [] unpack mTitle
|
||||
fNameLetters = Set.fromList $ unpack fName
|
||||
sNameLetters = Set.fromList $ unpack sName
|
||||
dNameLetters = Set.fromList $ unpack dName
|
||||
addLetters = Set.fromList [' ']
|
||||
addLetters = Set.fromList [' ', ',', '.']
|
||||
|
||||
isAdd = (`Set.member` addLetters)
|
||||
stripAdd = Text.dropWhileEnd isAdd -- ? Text.dropAround isAdd
|
||||
@ -269,7 +269,8 @@ addAttrsClass cl attrs = ("class", cl') : noClAttrs
|
||||
-- tickmark :: IsString a => a
|
||||
-- tickmark = fromString "✔"
|
||||
|
||||
-- | remove all Whitespace from Text
|
||||
-- | remove all whitespace from Text
|
||||
-- whereas Text.strip only removes leading and trailing whitespace
|
||||
stripAll :: Text -> Text
|
||||
stripAll = Text.filter (not . isSpace)
|
||||
|
||||
|
||||
@ -5,5 +5,5 @@ $newline never
|
||||
<li>Der angezeigte Name muss vollständig aus Fragmenten des akademischen Titels („#{title}“), des Vornamens („#{userFirstName}“) und des Nachnamens („#{userSurname}“) bestehen.
|
||||
$nothing
|
||||
<li>Der angezeigte Name muss vollständig aus Fragmenten des Vornamens („#{userFirstName}“) und des Nachnamens („#{userSurname}“) bestehen.
|
||||
<li>Der angezeigte Name darf keine mehrfachen Leerzeichen enthalten.
|
||||
<li>Der angezeigter Name darf keine Sonderzeichen enthalten, die in keinem der Namensbestandteile vorkommen.
|
||||
<li>Der angezeigte Name darf keine mehrfachen Leerzeichen, Kommata oder Punkte enthalten.
|
||||
<li>Der angezeigte Name darf keine Sonderzeichen außer Komma und Punkt enthalten, die in keinem der Namensbestandteile vorkommen.
|
||||
|
||||
@ -5,5 +5,5 @@ $newline never
|
||||
<li>The display name needs to consist entirely of fragments of the title (“#{title}”), the given name (“#{userFirstName}”), and the surname (“#{userSurname}”).
|
||||
$nothing
|
||||
<li>The display name needs to consist entirely of fragments of the given name (“#{userFirstName}”), and the surname (“#{userSurname}”).
|
||||
<li>The display name may not contain clusters of multiple whitespace characters.
|
||||
<li>The display name may not contain any special characters that do not occur in any part of the name.
|
||||
<li>The display name may not contain clusters of multiple whitespace or punctuation characters.
|
||||
<li>The display name may not contain any special characters that do not occur in any part of the name, apart from dot and comma.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user