- 02 Jun 2022
- 1 Minute to read
- Print
- DarkLight
DN Actions
- Updated on 02 Jun 2022
- 1 Minute to read
- Print
- DarkLight
DN Actions
compareDN
Compare two LDAP format DNs, returning 0 if dn1 == dn2, negative if dn1 < dn2, positive if dn1 > dn2, undefined if either dn is malformed
Property | Value | Description |
dn1* | text, expression, variable | the first DN |
dn2* | text, expression, variable | the second DN |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
# should return 0
cmp = compareDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6",
"cn=1, ou=2, o=3,dc=4,dc=5,dc=6")
# should return positive number
cmp = compareDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6",
"cn=1, ou=2, o=3,dc=4,dc=5")
# should return negative number
cmp = compareDN("cn=1, ou=2, o=3,dc=4,dc=5",
"cn=1,ou=2,o=3,dc=4,dc=5,dc=6")
equalsDN
Compare two LDAP format DNs for equality
Property | Value | Description |
dn1* | text, expression, variable | the first DN |
dn2* | text, expression, variable | the second DN |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
# should return true
equals = equalsDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6",
"CN=1, OU=2, O=3, DC=4, DC=5, DC=6")
getParentDN
Get the parent DN of an LDAP format DN
Property | Value | Description |
dn* | text, expression, variable | the DN |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
# should return ou=2,o=3,dc=4,dc=5,dc=6
parent = getParentDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6")
getRDN
Get the RDN of an LDAP format DN
Property | Value | Description |
dn* | text, expression, variable | the DN |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
# should return cn=1
parent = getRDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6")
isChildOfDN
Check if an LDAP format DN is a child of another DN
Property | Value | Description |
dn* | text, expression, variable | the child DN |
parentDn* | text, expression, variable | the parent DN |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
# should return true
isChild = isChildOfDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6",
"ou=2,o=3,dc=4,dc=5,dc=6")
# should return false
isChild = isChildOfDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6",
"o=3,dc=4,dc=5,dc=6")
isDescendantOfDN
Check if an LDAP format DN is a descendant of another DNCheck if an LDAP format DN is a descendant of another DN
Property | Value | Description |
dn* | text, expression, variable | the descendant DN |
ancestorDn* | text, expression, variable | the ancestor DN |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
# should return true
isChild = isChildOfDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6",
"ou=2,o=3,dc=4,dc=5,dc=6")
# should return true
isChild = isChildOfDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6",
"o=3,dc=4,dc=5,dc=6")
# should return false
isChild = isChildOfDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6",
"cn=2,ou=2,o=3,dc=4,dc=5,dc=6"")
splitDN
Split an LDAP format DN into an array of RDNs.
Property | Value | Description |
dn* | text, expression, variable | the DN |
limit | expression, variable | the maximum size of the array to return |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
# should return ["cn=1", "ou=2","o=3", "dc=4", "dc=5", "dc=5"]
rdns = splitDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=5")
splitRDN
Split an LDAP format RDN into an array of name/value pairs.
Property | Value | Description |
rdn* | text, expression, variable | the RDN |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
# should return [["cn", "x"], ["ou","y"], ["mail", "z"]]
split = splitRDN("cn=x+ou=y+mail=z")