Skip to content
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 5 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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: "",
Expand All @@ -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: "",
Expand All @@ -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))

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

Sensitive data returned by an access to RotateRecoveryLockPassword
flows to a logging call.

// 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))
}
Original file line number Diff line number Diff line change
Expand Up @@ -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: "",
Expand All @@ -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: "",
Expand All @@ -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
flows to a logging call.

// 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))
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func main() {
}

// ID of the computer prestage you want to retrieve
prestageID := "7" // Replace with the actual ID
prestageID := "45" // Replace with the actual ID

// Call the GetComputerPrestageByID function
prestage, err := client.GetComputerPrestageByID(prestageID)
Expand Down
Loading