Skip to content

Commit

Permalink
Merge pull request #14 from jamf/1.3.1-changes
Browse files Browse the repository at this point in the history
1.3.1 changes
  • Loading branch information
HarryStrandJamf authored Jun 28, 2024
2 parents 03da1de + 745f1c4 commit c7cbffa
Show file tree
Hide file tree
Showing 17 changed files with 229 additions and 104 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.1] - 2024-06-25
### Bug fixes
- Fixed an issue where some package fields for packages on the server would be overwritten with default values when packages were updated.
- Made it so you can delete a package on the Jamf Pro server that doesn't have a file associated with it, as long as "Files and associated packages" is selected.
- Fixed an issue where the Synchronize button may not activate after synchronization is completed.
- Made a change so when transferring files from JCDS distribution points to local or file share distribution points, it will retain the Posix and ACL permissions that are used when creating new files in the destination directory.
- Updated the command line argument help and the documentation regarding that.
- Made a change so that if connecting to a Jamf Pro server fails due to invalid credentials, it will prompt for credentials.
- Changed the prompt for the file share password to include the server address so it is more obvious what password to specify.

## [1.3.0] - 2024-05-08
### Features
- Added buttons below the source and destination distribution point to allow local files to be added or removed directly to/from the distribution point.
Expand Down
10 changes: 7 additions & 3 deletions Jamf Sync.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
84BC6E492AC380FD00CF6D39 /* FolderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BC6E482AC380FD00CF6D39 /* FolderView.swift */; };
84BC6E4D2AC38C6200CF6D39 /* FileShare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BC6E4A2AC38C6200CF6D39 /* FileShare.swift */; };
84BC6E552AC4933500CF6D39 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 84BC6E542AC4933500CF6D39 /* README.md */; };
84CAB0E52C25C47400582D59 /* FileManager+moveRetainingPermissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84CAB0E42C25C47400582D59 /* FileManager+moveRetainingPermissions.swift */; };
84CCB5D22B4C852F00328291 /* SetupViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84CCB5D12B4C852F00328291 /* SetupViewModel.swift */; };
84CCB5D42B4C946200328291 /* LogViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84CCB5D32B4C946200328291 /* LogViewModel.swift */; };
84CD1BAC2BBB132D008F0DF3 /* Subprocess in Frameworks */ = {isa = PBXBuildFile; productRef = 84CD1BAB2BBB132D008F0DF3 /* Subprocess */; };
Expand Down Expand Up @@ -169,6 +170,7 @@
84BC6E482AC380FD00CF6D39 /* FolderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FolderView.swift; sourceTree = "<group>"; };
84BC6E4A2AC38C6200CF6D39 /* FileShare.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileShare.swift; sourceTree = "<group>"; };
84BC6E542AC4933500CF6D39 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
84CAB0E42C25C47400582D59 /* FileManager+moveRetainingPermissions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FileManager+moveRetainingPermissions.swift"; sourceTree = "<group>"; };
84CCB5D12B4C852F00328291 /* SetupViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetupViewModel.swift; sourceTree = "<group>"; };
84CCB5D32B4C946200328291 /* LogViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogViewModel.swift; sourceTree = "<group>"; };
84D568612BD0722B00C91686 /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -375,14 +377,15 @@
84AB59C42B20D569007333AD /* CloudSessionDelegate.swift */,
84F258B42B76C81C00B8F401 /* CommandLineProcessing.swift */,
84761C9F2AFEE259006BBF72 /* FileHash.swift */,
84CAB0E42C25C47400582D59 /* FileManager+moveRetainingPermissions.swift */,
84BC6E4A2AC38C6200CF6D39 /* FileShare.swift */,
84F3331C2B48BEEF0037E4E5 /* FileShares.swift */,
84FC41652AD895F400DCB033 /* KeychainHelper.swift */,
8468917D2BCEC4BB00B9FCA4 /* OutputStream_write.swift */,
84DD583A2BC5C2A700E8DA23 /* URL+isDirectory.swift */,
84E489982B5AC80600FFFE59 /* UserSettings.swift */,
84FC415F2AD5A78C00DCB033 /* View+NSWindow.swift */,
849FC3402BD06A43008BAC02 /* VersionInfo.swift */,
84FC415F2AD5A78C00DCB033 /* View+NSWindow.swift */,
8412279E2BEADBB20097B83E /* XmlErrorParser.swift */,
);
path = Utility;
Expand Down Expand Up @@ -571,6 +574,7 @@
84FC41622AD7097300DCB033 /* SynchronizationProgress.swift in Sources */,
844CF9D12AC4B96600576E1A /* FolderDp.swift in Sources */,
84F258B52B76C81C00B8F401 /* CommandLineProcessing.swift in Sources */,
84CAB0E52C25C47400582D59 /* FileManager+moveRetainingPermissions.swift in Sources */,
84BC6E322AC3631400CF6D39 /* Checksum.swift in Sources */,
84BC6E452AC37F4100CF6D39 /* SetupView.swift in Sources */,
844E40D12B4F46FD003D1940 /* Checksums.swift in Sources */,
Expand Down Expand Up @@ -821,7 +825,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 1.3.0;
MARKETING_VERSION = 1.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.jamf.jamfsync;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -853,7 +857,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 1.3.0;
MARKETING_VERSION = 1.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.jamf.jamfsync;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
7 changes: 6 additions & 1 deletion JamfSync/Model/DataModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class DataModel: ObservableObject {
@Published var dpToPromptForPassword: FileShareDp?
@Published var shouldPromptForJamfProPassword = false
@Published var shouldPresentSetupSheet = false
@Published var synchronizationInProgress = false
private var dps: [DistributionPoint] = []
var firstLoad = true
var jamfProServersToPromptForPassword: [JamfProInstance] = []
var synchronizationInProgress = false
var loadingInProgressGroup: DispatchGroup?
private var updateListViewModelsTask: Task<Void, Error>?
private var updateChecksumsTask: Task<Void, Error>?
Expand Down Expand Up @@ -89,6 +89,11 @@ class DataModel: ObservableObject {
LogManager.shared.logMessage(message: "Bad credentials or access \(serverInfo)", level: .error)
} catch ServerCommunicationError.couldNotAccessServer {
LogManager.shared.logMessage(message: "Failed to access \(serverInfo)", level: .error)
} catch ServerCommunicationError.invalidCredentials {
if let jamfProInstance = savableItem as? JamfProInstance {
jamfProServersToPromptForPassword.append(jamfProInstance)
jamfProInstance.passwordOrClientSecret = ""
}
}
}
} catch {
Expand Down
2 changes: 1 addition & 1 deletion JamfSync/Model/DistributionPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class DistributionPoint: Identifiable {
let dstUrl = URL(fileURLWithPath: localPath).appendingPathComponent(filename)
try? fileManager.removeItem(at: dstUrl)
if let moveFrom {
try fileManager.moveItem(at: moveFrom, to: dstUrl)
try fileManager.moveRetainingDestinationPermisssions(at: moveFrom, to: dstUrl)
} else {
try fileManager.copyItem(at: srcUrl, to: dstUrl)
}
Expand Down
2 changes: 1 addition & 1 deletion JamfSync/Model/GeneralCloudDp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class GeneralCloudDp: DistributionPoint {
try fileManager.createDirectory(at: tempDirectory, withIntermediateDirectories: false)
localUrl = tempDirectory.appendingPathComponent(srcFile.name)
if let localUrl {
try fileManager.moveItem(at: moveFrom, to: localUrl)
try fileManager.moveRetainingDestinationPermisssions(at: moveFrom, to: localUrl)
}
}
}
Expand Down
28 changes: 14 additions & 14 deletions JamfSync/Model/JamfProPackageClassicApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class JamfProPackageClassicApi: JamfProPackageApi {
if let data = response.data {
let decoder = JSONDecoder()
let jsonPackage = try decoder.decode(JsonCapiPackageItem.self, from: data)
return Package(packageDetail: jsonPackage.package)
return Package(capiPackageDetail: jsonPackage.package)
}
return nil
}
Expand All @@ -114,24 +114,24 @@ class JamfProPackageClassicApi: JamfProPackageApi {
<package>
<id>\(jamfProPackageId)</id>
<name>\(package.displayName)</name>
<category>\(category)</category>
<category>\(category ?? "None")</category>
<filename>\(package.fileName)</filename>
<info/>
<notes/>
<priority>10</priority>
<reboot_required>false</reboot_required>
<fill_user_template>false</fill_user_template>
<fill_existing_users>false</fill_existing_users>
<allow_uninstalled>false</allow_uninstalled>
<os_requirements/>
<info>\(package.info ?? "")</info>
<notes>\(package.notes ?? "")</notes>
<priority>\(package.priority ?? 10)</priority>
<reboot_required>\(package.rebootRequired ?? false)</reboot_required>
<fill_user_template>\(package.fillUserTemplate ?? false)</fill_user_template>
<fill_existing_users>\(package.fillExistingUsers ?? false)</fill_existing_users>
<allow_uninstalled>\(package.uninstall ?? false)</allow_uninstalled>
<os_requirements>\(package.osRequirements ?? "")</os_requirements>
<required_processor>None</required_processor>
<hash_type>\(checksumTypeString)</hash_type>
<hash_value>\(checksum?.value ?? "")</hash_value>
<switch_with_package>Do Not Install</switch_with_package>
<install_if_reported_available>false</install_if_reported_available>
<reinstall_option>Do Not Reinstall</reinstall_option>
<switch_with_package>\(package.switch_with_package ?? "Do Not Install")</switch_with_package>
<install_if_reported_available>\(package.install_if_reported_available ?? "false")</install_if_reported_available>
<reinstall_option>\(package.reinstall_option ?? "Do Not Reinstall")</reinstall_option>
<triggering_files/>
<send_notification>false</send_notification>
<send_notification>\(package.send_notification ?? false)</send_notification>
</package>
"""
}
Expand Down
17 changes: 1 addition & 16 deletions JamfSync/Model/JamfProPackageUApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class JamfProPackageUApi: JamfProPackageApi {
let jsonUapiPackageDetail = JsonUapiPackageDetail(package: package)
let jsonEncoder = JSONEncoder()
let jsonData = try jsonEncoder.encode(jsonUapiPackageDetail)
NSLog("jsonData = \n\(String(data: jsonData, encoding: .utf8) ?? "nil")")
let response = try await jamfProInstance.dataRequest(url: packageUrl, httpMethod: "POST", httpBody: jsonData, contentType: "application/json")
if let data = response.data {
let decoder = JSONDecoder()
Expand Down Expand Up @@ -96,20 +95,6 @@ class JamfProPackageUApi: JamfProPackageApi {

private func convertToPackage(jsonPackage: JsonUapiPackageDetail) -> Package? {
guard let jamfProIdString = jsonPackage.id, let jamfProId = Int(jamfProIdString), let displayName = jsonPackage.packageName, let fileName = jsonPackage.fileName else { return nil }
let checksums = Checksums()
if let md5Value = jsonPackage.md5, !md5Value.isEmpty {
checksums.updateChecksum(Checksum(type: .MD5, value: md5Value))
}
if let sha256Value = jsonPackage.sha256, !sha256Value.isEmpty {
checksums.updateChecksum(Checksum(type: .SHA_256, value: sha256Value))
}
if let hashType = jsonPackage.hashType, !hashType.isEmpty, let hashValue = jsonPackage.hashValue, !hashValue.isEmpty {
checksums.updateChecksum(Checksum(type: ChecksumType.fromRawValue(hashType), value: hashValue))
}
var size: Int64?
if let sizeString = jsonPackage.size {
size = Int64(sizeString)
}
return Package(jamfProId: jamfProId, displayName: displayName, fileName: fileName, category: jsonPackage.categoryId ?? "-1", size: size, checksums: checksums)
return Package(uapiPackageDetail: jsonPackage)
}
}
2 changes: 1 addition & 1 deletion JamfSync/Model/Jcds2Dp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Jcds2Dp: DistributionPoint {
try fileManager.createDirectory(at: tempDirectory, withIntermediateDirectories: false)
localUrl = tempDirectory.appendingPathComponent(srcFile.name)
if let localUrl {
try fileManager.moveItem(at: moveFrom, to: localUrl)
try fileManager.moveRetainingDestinationPermisssions(at: moveFrom, to: localUrl)
}
}
}
Expand Down
51 changes: 26 additions & 25 deletions JamfSync/Model/JsonObjects.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,16 @@ struct JsonUapiPackageDetail: Codable {
packageName = package.displayName
fileName = package.fileName
categoryId = package.category
priority = 10
fillUserTemplate = false
uninstall = false
rebootRequired = false
osInstall = false
suppressUpdates = false
suppressFromDock = false
suppressEula = false
suppressRegistration = false
categoryId = package.categoryId ?? "-1"
priority = package.priority ?? 10
fillUserTemplate = package.fillUserTemplate ?? false
uninstall = package.uninstall ?? false
rebootRequired = package.rebootRequired ?? false
osInstall = package.osInstall ?? false
suppressUpdates = package.suppressUpdates ?? false
suppressFromDock = package.suppressFromDock ?? false
suppressEula = package.suppressEula ?? false
suppressRegistration = package.suppressRegistration ?? false
if let checksum = package.checksums.findChecksum(type: .MD5) {
md5 = checksum.value
} else {
Expand All @@ -152,22 +153,22 @@ struct JsonUapiPackageDetail: Codable {
size = nil
}

info = nil
notes = nil
osRequirements = nil
indexed = nil
fillExistingUsers = nil
swu = nil
selfHealNotify = nil
selfHealingAction = nil
serialNumber = nil
parentPackageId = nil
basePath = nil
cloudTransferStatus = nil
ignoreConflicts = nil
installLanguage = nil
osInstallerVersion = nil
format = nil
info = package.info
notes = package.notes
osRequirements = package.osRequirements
indexed = package.indexed
fillExistingUsers = package.fillExistingUsers
swu = package.swu
selfHealNotify = package.selfHealNotify
selfHealingAction = package.selfHealingAction
serialNumber = package.serialNumber
parentPackageId = package.parentPackageId
basePath = package.basePath
cloudTransferStatus = package.cloudTransferStatus
ignoreConflicts = package.ignoreConflicts
installLanguage = package.installLanguage
osInstallerVersion = package.osInstallerVersion
format = package.format
}
}

Expand Down
Loading

0 comments on commit c7cbffa

Please sign in to comment.