SAP / macOS-enterprise-privileges

For Mac users in enterprise environments, this application gives users control over the administration of their machine by elevating their level of access to administrator privileges on macOS. Users can set a timeframe in the application's settings to perform specific tasks, such as installing or removing an application.
Apache License 2.0
1.32k stars 149 forks source link

Use Standard Array for ReasonPresetList Key #44

Closed irahodges closed 2 years ago

irahodges commented 2 years ago

It would be preferable for the ReasonPresetList key to use a standard array of strings as opposed to an array of dictionary objects in the managed preference like this:

<key>ReasonPresetList</key>
        <array>
            <string>Reason1</string>
            <string>Reason2</string>
            <string>Reason3</string>
        </array>

I know this would at least help in using the Jamf json schema more easily.

dammitbenny commented 2 years ago

Nesting an object under the array in the JSON schema manifest results in a plist that matches the same structure in the example configuration profile. Not the prettiest, but this worked for me in testing.

"ReasonPresetList": {
   "title": "Reason preset list",
   "description": "If the ReasonRequired key's value is set to true, this optional key allows a pre-defined list of reasons for requesting admin privileges. If the ReasonPresetList key is set, a pop-up menu will appear in the window where the user enters reasons. This menu will contain all of the pre-defined reasons and an Other option. If Other is selected, a text field will appear where the user can enter a reason using text entry.",
   "property_order": 45,
   "type": "array",
   "items": {
      "type": "object",
      "properties": {
         "default": {
            "title": "Reason",
            "type": "string"
         }
      }
   }
},
irahodges commented 2 years ago

Ah - now I feel like an idiot. Thanks for sharing!