Common_Name_to_Given_Name

Understanding Oracle Virtual Directory Mapping 5-5 common name. For example, the filter cn=Marc Boorshtein would have to read givenName=Marcsn=Boorshtein. Mapping Requirements The following is a list of hypothetical requirements for this example mapping: ■ When data is retrieved from the adapter, you want to form a cn by combining givenname with sn. ■ On the inbound side, you want to split cn into givenname and sn. If cn is present in the attribute request list, the list is changed to include givenname and sn. ■ If the inbound operation is a search operation, you want to check the search filter and convert the cn appropriately. Mapping def parceCNval: return splitval, ,2 def inbound: map the cn filters if operation == get: if haveAttributecn: addAttributegivenName addAttributesn cnFilters = findFilterscn for filter in cnFilters: target,op,val = filter.contents givenNameVal, snVal = parceCNval givenNameFilter = createFiltergivenName,op,givenNameVal snFilter = createFiltersn,op,snVal filter.contents = createAndFilter[givenNameFilter,snFilter] def outbound: outbound stuff addAttributeValuecn,getAttributeValuegivenName + + getAttributeValuesn Inbound Processing In the inbound function you want to convert any cn into separate givenname and sn attributes. For a search, you want to convert search filters for cn into a combined filter for givenname and sn so you create a new function, parceCN. On the first line of the mapping, the split function is imported from the Python string module. The parseCN Python function is defined to take a cn and split it into a first and last name based on detecting a space. Next, you define the inbound function. The inbound function could deal with any LDAP operation, but in this case, you are interested in looking at search operations. The first line after inbound is therefore an if block that tests the value of operation. The variable operation contains either add, bind, delete, get, modify, or rename. Note: In reality, this is more complex, for example, when middle names are used. For the purposes of this example, consider this simple case to get started. Contact your Oracle Support representative for help with advanced mapping situations.