User Provided Key Names
In certain situations with preferences that live within a dictionary
, it may be necessary to not explicitly define the contained preference key names. This is either because there are too many possible keys, or that these can be customized by the user/admin.
It is possible to allow users to supply both the desired preference key name as well as the corresponding value within a manifest by using {{key}}
and {{value}}
as placeholders within a dictionary
. An example of this can be found in the NoMAD manifest (com.trusourcelabs.NoMAD
) with the KeychainItems
preference.
<dict>
<key>pfm_app_min</key>
<string>1.1.0</string>
<key>pfm_description</key>
<string>Items to update when the user's local password is updated as well.</string>
<key>pfm_name</key>
<string>KeychainItems</string>
<key>pfm_subkeys</key>
<array>
<dict>
<key>pfm_description</key>
<string></string>
<key>pfm_name</key>
<string>{{key}}</string>
<key>pfm_title</key>
<string>Keychain Item</string>
<key>pfm_type</key>
<string>string</string>
<key>pfm_value_placeholder</key>
<string>Exchange</string>
</dict>
<dict>
<key>pfm_description</key>
<string></string>
<key>pfm_name</key>
<string>{{value}}</string>
<key>pfm_title</key>
<string>Account</string>
<key>pfm_type</key>
<string>string</string>
<key>pfm_value_placeholder</key>
<string><<shortname>>@<<domain>>.onmicrosoft.com</string>
</dict>
</array>
<key>pfm_title</key>
<string>KeychainItems</string>
<key>pfm_type</key>
<string>dictionary</string>
</dict>
You will notice that KeychainItems
is configured as a dictionary
with two dictionaries configured within the pfm_subkeys
key. The first dictionary has a value of {{key}}
for the pfm_name
key while second has a value of {{value}}
for pfm_name
. The pfm_type
for the {{key}}
will always be string
.
This is what produces the UI in ProfileCreator to allow users/admins to provide their own key name(s) and values.
Help other users/admins by providing a pfm_title
to make it clear what information needs to be provided in each field.