-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
+added recipe for exports api privileges by api integration #461
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
847296d
+ bool pointer helpers and made computer prestage bools use pointers
ShocOne f3fd7a4
Refactor computer prestage creation to use bool pointers for optional…
ShocOne 602a273
Refactor computer prestage creation to use bool pointers for optional…
ShocOne 56c9a7b
chore: Update Jamf Pro API return-to-service structs and methods
ShocOne addd85c
chore: Export all assigned privileges by API integration
ShocOne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,47 +19,45 @@ | |
} | ||
|
||
// Define the payload for creating a new computer prestage | ||
// Manually create a ResourceComputerPrestage struct with mapped values | ||
prestage := jamfpro.ResourceComputerPrestage{ | ||
DisplayName: "jamfpro-sdk-example-computerPrestageFull-config", | ||
Mandatory: true, | ||
MDMRemovable: true, | ||
SupportPhoneNumber: "118-118", | ||
//ID: "-1", | ||
DisplayName: "jamfpro-sdk-example-computerPrestageMinimum-config", | ||
Mandatory: jamfpro.TruePtr(), | ||
MDMRemovable: jamfpro.TruePtr(), | ||
SupportPhoneNumber: "111-222-3333", | ||
SupportEmailAddress: "[email protected]", | ||
Department: "department name", | ||
DefaultPrestage: false, | ||
DefaultPrestage: jamfpro.FalsePtr(), | ||
EnrollmentSiteId: "-1", | ||
KeepExistingSiteMembership: true, | ||
KeepExistingLocationInformation: true, | ||
RequireAuthentication: true, | ||
KeepExistingSiteMembership: jamfpro.FalsePtr(), | ||
KeepExistingLocationInformation: jamfpro.FalsePtr(), | ||
RequireAuthentication: jamfpro.FalsePtr(), | ||
AuthenticationPrompt: "hello welcome to your enterprise managed macOS device", | ||
PreventActivationLock: false, | ||
EnableDeviceBasedActivationLock: false, | ||
EnableRecoveryLock: false, | ||
RecoveryLockPasswordType: "MANUAL", | ||
RotateRecoveryLockPassword: false, | ||
PreventActivationLock: jamfpro.FalsePtr(), | ||
EnableDeviceBasedActivationLock: jamfpro.FalsePtr(), | ||
DeviceEnrollmentProgramInstanceId: "1", | ||
SkipSetupItems: jamfpro.ComputerPrestageSubsetSkipSetupItems{ | ||
Accessibility: true, | ||
Appearance: true, | ||
AppleID: true, | ||
Biometric: true, | ||
Diagnostics: true, | ||
DisplayTone: true, | ||
FileVault: true, | ||
Location: true, | ||
Payment: true, | ||
Privacy: true, | ||
Registration: true, | ||
Restore: true, | ||
ScreenTime: true, | ||
Siri: true, | ||
TOS: true, | ||
TermsOfAddress: true, | ||
ICloudDiagnostics: true, | ||
ICloudStorage: true, | ||
Biometric: jamfpro.FalsePtr(), | ||
TermsOfAddress: jamfpro.FalsePtr(), | ||
FileVault: jamfpro.FalsePtr(), | ||
ICloudDiagnostics: jamfpro.FalsePtr(), | ||
Diagnostics: jamfpro.FalsePtr(), | ||
Accessibility: jamfpro.FalsePtr(), | ||
AppleID: jamfpro.FalsePtr(), | ||
ScreenTime: jamfpro.FalsePtr(), | ||
Siri: jamfpro.FalsePtr(), | ||
DisplayTone: jamfpro.FalsePtr(), | ||
Restore: jamfpro.FalsePtr(), | ||
Appearance: jamfpro.FalsePtr(), | ||
Privacy: jamfpro.FalsePtr(), | ||
Payment: jamfpro.FalsePtr(), | ||
Registration: jamfpro.FalsePtr(), | ||
TOS: jamfpro.FalsePtr(), | ||
ICloudStorage: jamfpro.FalsePtr(), | ||
Location: jamfpro.FalsePtr(), | ||
}, | ||
LocationInformation: jamfpro.ComputerPrestageSubsetLocationInformation{ | ||
//ID: "-1", | ||
Username: "", | ||
Realname: "", | ||
Phone: "", | ||
|
@@ -68,13 +66,12 @@ | |
Position: "", | ||
DepartmentId: "-1", | ||
BuildingId: "-1", | ||
ID: "1", | ||
VersionLock: 0, | ||
VersionLock: 1, | ||
}, | ||
PurchasingInformation: jamfpro.ComputerPrestageSubsetPurchasingInformation{ | ||
ID: "1", | ||
Leased: false, | ||
Purchased: true, | ||
//ID: "-1", | ||
Leased: jamfpro.FalsePtr(), | ||
Purchased: jamfpro.TruePtr(), | ||
AppleCareId: "", | ||
PONumber: "", | ||
Vendor: "", | ||
|
@@ -85,54 +82,59 @@ | |
LeaseDate: "1970-01-01", | ||
PODate: "1970-01-01", | ||
WarrantyDate: "1970-01-01", | ||
VersionLock: 0, | ||
VersionLock: 1, | ||
}, | ||
AnchorCertificates: []string{}, | ||
EnrollmentCustomizationId: "0", | ||
Language: "en", | ||
Region: "GB", | ||
AutoAdvanceSetup: true, | ||
InstallProfilesDuringSetup: true, | ||
AutoAdvanceSetup: jamfpro.FalsePtr(), | ||
InstallProfilesDuringSetup: jamfpro.TruePtr(), | ||
PrestageInstalledProfileIds: []string{ | ||
"287", | ||
"288", | ||
"289"}, | ||
CustomPackageIds: []string{ | ||
"3", | ||
"3847", | ||
"3864", | ||
"3806", | ||
}, | ||
CustomPackageIds: []string{}, | ||
CustomPackageDistributionPointId: "-1", | ||
ID: "1", | ||
ProfileUuid: "C101330EE870D6082D5D08FA013ADE51", | ||
EnableRecoveryLock: jamfpro.FalsePtr(), | ||
RecoveryLockPasswordType: "MANUAL", | ||
RotateRecoveryLockPassword: jamfpro.FalsePtr(), | ||
ProfileUuid: "0386E7C8D455A040106850A8A2033968", | ||
SiteId: "-1", | ||
VersionLock: 3, | ||
VersionLock: 1, | ||
AccountSettings: jamfpro.ComputerPrestageSubsetAccountSettings{ | ||
ID: "1", | ||
PayloadConfigured: true, | ||
LocalAdminAccountEnabled: true, | ||
AdminUsername: "localAdmin", | ||
AdminPassword: "thingthing1010", | ||
HiddenAdminAccount: true, | ||
LocalUserManaged: false, | ||
//ID: "-1", | ||
PayloadConfigured: jamfpro.TruePtr(), | ||
LocalAdminAccountEnabled: jamfpro.FalsePtr(), | ||
AdminUsername: "", | ||
AdminPassword: "", | ||
HiddenAdminAccount: jamfpro.FalsePtr(), | ||
LocalUserManaged: jamfpro.FalsePtr(), | ||
UserAccountType: "ADMINISTRATOR", | ||
VersionLock: 1, | ||
PrefillPrimaryAccountInfoFeatureEnabled: false, | ||
PrefillType: "CUSTOM", | ||
PrefillAccountFullName: "", | ||
PrefillAccountUserName: "", | ||
PreventPrefillInfoFromModification: false, | ||
PrefillPrimaryAccountInfoFeatureEnabled: jamfpro.FalsePtr(), | ||
PrefillType: "UNKNOWN", | ||
PreventPrefillInfoFromModification: jamfpro.FalsePtr(), | ||
}, | ||
} | ||
|
||
// Marshal the prestage struct to JSON and print it | ||
prestageJSON, err := json.MarshalIndent(prestage, "", " ") | ||
if err != nil { | ||
log.Fatalf("Error marshaling prestage data: %v", err) | ||
} | ||
fmt.Println("Prestage configuration to be sent:") | ||
fmt.Println(string(prestageJSON)) | ||
|
||
// Call the CreateComputerPrestage function | ||
createdPrestage, err := client.CreateComputerPrestage(&prestage) | ||
if err != nil { | ||
log.Fatalf("Error creating computer prestage: %v", err) | ||
} | ||
|
||
// Pretty print the computer prestage in JSON | ||
prestageJSON, err := json.MarshalIndent(createdPrestage, "", " ") // Indent with 4 spaces | ||
// Pretty print the created computer prestage in JSON | ||
createdPrestageJSON, err := json.MarshalIndent(createdPrestage, "", " ") | ||
if err != nil { | ||
log.Fatalf("Error marshaling computer prestage data: %v", err) | ||
log.Fatalf("Error marshaling created prestage data: %v", err) | ||
} | ||
fmt.Println("Created computer prestage:\n", string(prestageJSON)) | ||
fmt.Println("Created computer prestage:") | ||
fmt.Println(string(createdPrestageJSON)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,44 +19,45 @@ | |
} | ||
|
||
// Define the payload for creating a new computer prestage | ||
// Manually create a ResourceComputerPrestage struct with mapped values | ||
prestage := jamfpro.ResourceComputerPrestage{ | ||
DisplayName: "jamfpro-sdk-example-computerPrestage-config", | ||
Mandatory: true, | ||
MDMRemovable: false, | ||
SupportPhoneNumber: "", | ||
SupportEmailAddress: "", | ||
Department: "", | ||
DefaultPrestage: false, | ||
//ID: "-1", | ||
DisplayName: "jamfpro-sdk-example-computerPrestageMinimum-config", | ||
Mandatory: jamfpro.TruePtr(), | ||
MDMRemovable: jamfpro.TruePtr(), | ||
SupportPhoneNumber: "111-222-3333", | ||
SupportEmailAddress: "[email protected]", | ||
Department: "department name", | ||
DefaultPrestage: jamfpro.FalsePtr(), | ||
EnrollmentSiteId: "-1", | ||
KeepExistingSiteMembership: false, | ||
KeepExistingLocationInformation: false, | ||
RequireAuthentication: false, | ||
AuthenticationPrompt: "", | ||
PreventActivationLock: true, | ||
EnableDeviceBasedActivationLock: false, | ||
KeepExistingSiteMembership: jamfpro.FalsePtr(), | ||
KeepExistingLocationInformation: jamfpro.FalsePtr(), | ||
RequireAuthentication: jamfpro.FalsePtr(), | ||
AuthenticationPrompt: "hello welcome to your enterprise managed macOS device", | ||
PreventActivationLock: jamfpro.FalsePtr(), | ||
EnableDeviceBasedActivationLock: jamfpro.FalsePtr(), | ||
DeviceEnrollmentProgramInstanceId: "1", | ||
SkipSetupItems: jamfpro.ComputerPrestageSubsetSkipSetupItems{ | ||
Accessibility: true, | ||
Appearance: true, | ||
AppleID: true, | ||
Biometric: true, | ||
Diagnostics: true, | ||
DisplayTone: true, | ||
FileVault: true, | ||
Location: true, | ||
Payment: true, | ||
Privacy: true, | ||
Registration: true, | ||
Restore: true, | ||
ScreenTime: true, | ||
Siri: true, | ||
TOS: true, | ||
TermsOfAddress: true, | ||
ICloudDiagnostics: true, | ||
ICloudStorage: true, | ||
Biometric: jamfpro.FalsePtr(), | ||
TermsOfAddress: jamfpro.FalsePtr(), | ||
FileVault: jamfpro.FalsePtr(), | ||
ICloudDiagnostics: jamfpro.FalsePtr(), | ||
Diagnostics: jamfpro.FalsePtr(), | ||
Accessibility: jamfpro.FalsePtr(), | ||
AppleID: jamfpro.FalsePtr(), | ||
ScreenTime: jamfpro.FalsePtr(), | ||
Siri: jamfpro.FalsePtr(), | ||
DisplayTone: jamfpro.FalsePtr(), | ||
Restore: jamfpro.FalsePtr(), | ||
Appearance: jamfpro.FalsePtr(), | ||
Privacy: jamfpro.FalsePtr(), | ||
Payment: jamfpro.FalsePtr(), | ||
Registration: jamfpro.FalsePtr(), | ||
TOS: jamfpro.FalsePtr(), | ||
ICloudStorage: jamfpro.FalsePtr(), | ||
Location: jamfpro.FalsePtr(), | ||
}, | ||
LocationInformation: jamfpro.ComputerPrestageSubsetLocationInformation{ | ||
//ID: "-1", | ||
Username: "", | ||
Realname: "", | ||
Phone: "", | ||
|
@@ -65,13 +66,12 @@ | |
Position: "", | ||
DepartmentId: "-1", | ||
BuildingId: "-1", | ||
ID: "1", | ||
VersionLock: 0, | ||
}, | ||
PurchasingInformation: jamfpro.ComputerPrestageSubsetPurchasingInformation{ | ||
ID: "1", | ||
Leased: false, | ||
Purchased: true, | ||
//ID: "-1", | ||
Leased: jamfpro.FalsePtr(), | ||
Purchased: jamfpro.TruePtr(), | ||
AppleCareId: "", | ||
PONumber: "", | ||
Vendor: "", | ||
|
@@ -84,49 +84,57 @@ | |
WarrantyDate: "1970-01-01", | ||
VersionLock: 0, | ||
}, | ||
AnchorCertificates: []string{}, | ||
EnrollmentCustomizationId: "0", | ||
Language: "en", | ||
Region: "GB", | ||
AutoAdvanceSetup: true, | ||
InstallProfilesDuringSetup: true, | ||
PrestageInstalledProfileIds: []string{}, | ||
EnrollmentCustomizationId: "0", | ||
AutoAdvanceSetup: jamfpro.FalsePtr(), | ||
InstallProfilesDuringSetup: jamfpro.TruePtr(), | ||
PrestageInstalledProfileIds: []string{ | ||
"3847", | ||
"3864", | ||
"3806", | ||
}, | ||
CustomPackageIds: []string{}, | ||
CustomPackageDistributionPointId: "-1", | ||
EnableRecoveryLock: false, | ||
EnableRecoveryLock: jamfpro.FalsePtr(), | ||
RecoveryLockPasswordType: "MANUAL", | ||
RotateRecoveryLockPassword: false, | ||
ID: "1", | ||
ProfileUuid: "C101330EE870D6082D5D08FA013ADE51", | ||
RotateRecoveryLockPassword: jamfpro.FalsePtr(), | ||
ProfileUuid: "0386E7C8D455A040106850A8A2033968", | ||
SiteId: "-1", | ||
VersionLock: 3, | ||
VersionLock: 0, | ||
AccountSettings: jamfpro.ComputerPrestageSubsetAccountSettings{ | ||
ID: "1", | ||
PayloadConfigured: true, | ||
LocalAdminAccountEnabled: true, | ||
AdminUsername: "localAdmin", | ||
HiddenAdminAccount: true, | ||
LocalUserManaged: false, | ||
//ID: "-1", | ||
PayloadConfigured: jamfpro.TruePtr(), | ||
LocalAdminAccountEnabled: jamfpro.FalsePtr(), | ||
AdminUsername: "", | ||
AdminPassword: "", | ||
HiddenAdminAccount: jamfpro.FalsePtr(), | ||
LocalUserManaged: jamfpro.FalsePtr(), | ||
UserAccountType: "ADMINISTRATOR", | ||
VersionLock: 1, | ||
PrefillPrimaryAccountInfoFeatureEnabled: false, | ||
PrefillType: "CUSTOM", | ||
PrefillAccountFullName: "", | ||
PrefillAccountUserName: "", | ||
PreventPrefillInfoFromModification: false, | ||
VersionLock: 0, | ||
PrefillPrimaryAccountInfoFeatureEnabled: jamfpro.FalsePtr(), | ||
PrefillType: "UNKNOWN", | ||
PreventPrefillInfoFromModification: jamfpro.FalsePtr(), | ||
}, | ||
} | ||
|
||
// Marshal the prestage struct to JSON and print it | ||
prestageJSON, err := json.MarshalIndent(prestage, "", " ") | ||
if err != nil { | ||
log.Fatalf("Error marshaling prestage data: %v", err) | ||
} | ||
fmt.Println("Prestage configuration to be sent:") | ||
fmt.Println(string(prestageJSON)) | ||
Check failure Code scanning / CodeQL Clear-text logging of sensitive information High Sensitive data returned by an access to RotateRecoveryLockPassword Error loading related location Loading |
||
|
||
// Call the CreateComputerPrestage function | ||
createdPrestage, err := client.CreateComputerPrestage(&prestage) | ||
if err != nil { | ||
log.Fatalf("Error creating computer prestage: %v", err) | ||
} | ||
|
||
// Pretty print the computer prestage in JSON | ||
prestageJSON, err := json.MarshalIndent(createdPrestage, "", " ") // Indent with 4 spaces | ||
// Pretty print the created computer prestage in JSON | ||
createdPrestageJSON, err := json.MarshalIndent(createdPrestage, "", " ") | ||
if err != nil { | ||
log.Fatalf("Error marshaling computer prestage data: %v", err) | ||
log.Fatalf("Error marshaling created prestage data: %v", err) | ||
} | ||
fmt.Println("Created computer prestage:\n", string(prestageJSON)) | ||
fmt.Println("Created computer prestage:") | ||
fmt.Println(string(createdPrestageJSON)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High