Skip to content

Commit

Permalink
Add new pppc keys (#81)
Browse files Browse the repository at this point in the history
* Added changelog entry for ty's fix

* updated the changelog with author tags

* adding in some unit tests to help with making changes to the structure in the future

* Added allowed and authorization as optionals so they can be left out of the xml as needed.

* Updated the change log

* added some tests for handling the authoriztion vs allowed legacy property.

* Added the new Authorization key as the default instead of Allowed

* Added some more tests around importing a profile and making sure it handles the new key correctly

* Added constants for the key display values and some more tests around importing and exporting

* Fixed the parsing issue when importing a profile with apple events and added unit tests

* Added the new key to the drop down for screen capture and listen event.

* Added some support for an info message if the user is trying to use the new Authorization key, warning them it is only Big Sur and above

* Working through some changes. There are currently failing unit tests and an incomplete UI implementation of the NSSwitch for big sur.

* Fix application list layout

* Revert "Fix application list layout"

This reverts commit 832fef1.

* Fix Applications table view cell height

* Fixing some more UI issues and causing some others

* fixed up the unit tests

* Fix table view cell height

* Changed the width of the popup buttons to allow for the new value to be seen clearly.

* More UI tweaks and also added a cancel option for the alert when users are going away from big sur mode and might lose some data.

* Added constrainsts for the big sur switch

* Got rid of as many interface builder warnings as I could. There is still one annoying one not resolved about a fixed width, and also some content notices on the storyboard.

* Moved the import button to the same row as the Save and Upload buttons.

* upgraded swiftlint and fixed the issue

* Fixed some wording and spelling issues.
Updated version to 1.3.0

* Added spacing in the error message for better readablility

* added note to changelog that 10.15 is the min deployment target now

* changed to use a setup() method for the ModelTests

* Removed a comment and made the method name more descriptive.

* Updated readme to reference 10.15 as the min version

* changed the format of switch statments to be consistent

* added guard in weak self pointer is actually nil

* disabled hardened runtime for debug builds so that unit tests can be run with "Sign to Run Locally"

* Added some internal jenkins related files.

* adding a sleep for troubleshooting

* Adding import to the shared fastlane lib using ENV

* Trying to fix the build issues by taking of sign to run locally

* removed Jenkins changes and moved them to another experimental branch

* changed back to use the hardented runtime for debug mode to try and fix the buld

* Going back to setting the team explicitly.

* Disabled the hardened runtime again so the unit tests locally can be run.

* One more try at the build by turning off automatic code signing

* Only changing back the main app not the unit tests to see if we can at least build.

* giving up, just leaving the team assigned

Co-authored-by: Tony Eichelberger <tony.eichelberger@jamf.com>
Co-authored-by: Isaac Halvorson <isaac.halvorson@jamf.com>
  • Loading branch information
3 people authored Oct 22, 2020
1 parent 8b505c1 commit 9878cc2
Show file tree
Hide file tree
Showing 15 changed files with 1,079 additions and 216 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
<!-- Add any information here about changes in master that have yet to be released -->

### Added
- @(author) description

## [1.3.0]

### Added

- (@hisaac) Added this changelog file
- (@ty-wilson) Fixed issue #72 changing the default value on Apple Events to "Allow"
- (@watkyn) Added support for the new Authorization key in Big Sur
- (@watkyn) Changed minimum deployment target to macOS 10.15

- Added this changelog file

## [1.2.1] - 2020-09-17

Expand Down
54 changes: 38 additions & 16 deletions PPPC Utility.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/* Begin PBXBuildFile section */
345B01D623FDBF55008838B6 /* TCCProfileExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 345B01D523FDBF55008838B6 /* TCCProfileExtensions.swift */; };
345B01D723FDBF55008838B6 /* TCCProfileExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 345B01D523FDBF55008838B6 /* TCCProfileExtensions.swift */; };
34DED4D323FDC77E00C53FB9 /* TCCProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6EC409F4214D95D200BE4F17 /* TCCProfile.swift */; };
34DED4D423FDCAFD00C53FB9 /* SwiftyCMSDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F95AE1523158F03002E0A22 /* SwiftyCMSDecoder.swift */; };
34DED4D623FDDB2B00C53FB9 /* TCCProfileConfigurationPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34DED4D523FDDB2B00C53FB9 /* TCCProfileConfigurationPanel.swift */; };
5901A2772534DF1400A1CD2F /* ModelBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5901A2762534DF1400A1CD2F /* ModelBuilder.swift */; };
59206D6925265F0C00B94795 /* TCCProfileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59206D6825265F0C00B94795 /* TCCProfileTests.swift */; };
59798B82252D16310070A204 /* TCCProfileBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59798B81252D16310070A204 /* TCCProfileBuilder.swift */; };
5F90EBDD2319934F00738D09 /* ArrayExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F90EBDC2319934F00738D09 /* ArrayExtensions.swift */; };
5F90EBDF2319970000738D09 /* TCCProfileImportError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F90EBDE2319970000738D09 /* TCCProfileImportError.swift */; };
5F90EBE12319970500738D09 /* TCCProfileImporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F90EBE02319970500738D09 /* TCCProfileImporter.swift */; };
Expand Down Expand Up @@ -56,6 +57,9 @@
/* Begin PBXFileReference section */
345B01D523FDBF55008838B6 /* TCCProfileExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TCCProfileExtensions.swift; sourceTree = "<group>"; };
34DED4D523FDDB2B00C53FB9 /* TCCProfileConfigurationPanel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TCCProfileConfigurationPanel.swift; sourceTree = "<group>"; };
5901A2762534DF1400A1CD2F /* ModelBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelBuilder.swift; sourceTree = "<group>"; };
59206D6825265F0C00B94795 /* TCCProfileTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TCCProfileTests.swift; sourceTree = "<group>"; };
59798B81252D16310070A204 /* TCCProfileBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TCCProfileBuilder.swift; sourceTree = "<group>"; };
5F90EBDC2319934F00738D09 /* ArrayExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayExtensions.swift; sourceTree = "<group>"; };
5F90EBDE2319970000738D09 /* TCCProfileImportError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TCCProfileImportError.swift; sourceTree = "<group>"; };
5F90EBE02319970500738D09 /* TCCProfileImporter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TCCProfileImporter.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -112,6 +116,15 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
5901A2752534DEFF00A1CD2F /* Helpers */ = {
isa = PBXGroup;
children = (
59798B81252D16310070A204 /* TCCProfileBuilder.swift */,
5901A2762534DF1400A1CD2F /* ModelBuilder.swift */,
);
path = Helpers;
sourceTree = "<group>";
};
5F90EBDB2319931100738D09 /* Extensions */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -151,6 +164,7 @@
5F95AE1C2315A6AD002E0A22 /* PPPC UtilityTests */ = {
isa = PBXGroup;
children = (
5901A2752534DEFF00A1CD2F /* Helpers */,
5F90EBE22319991600738D09 /* ModelTests */,
5F95AE272315B069002E0A22 /* TCCProfileImporter */,
5F95AE1F2315A6AD002E0A22 /* Info.plist */,
Expand All @@ -166,13 +180,15 @@
5F95AE2C2315B172002E0A22 /* TestTCCUnsignedProfile-Empty.mobileconfig */,
5F95AE292315B172002E0A22 /* TestTCCUnsignedProfile.mobileconfig */,
5F95AE252315A7CB002E0A22 /* TCCProfileImporterTests.swift */,
59206D6825265F0C00B94795 /* TCCProfileTests.swift */,
);
path = TCCProfileImporter;
sourceTree = "<group>";
};
6E651CC623143969001CC974 /* Views */ = {
isa = PBXGroup;
children = (
B5E09547250BCCFC00A40409 /* Alert.swift */,
6E651CC72314397D001CC974 /* FlippedClipView.swift */,
6E651CC9231439CE001CC974 /* InfoButton.swift */,
);
Expand Down Expand Up @@ -230,7 +246,6 @@
6EC40A1D214EF87E00BE4F17 /* Model */ = {
isa = PBXGroup;
children = (
B5E09547250BCCFC00A40409 /* Alert.swift */,
6EC40A1B214EF87800BE4F17 /* SigningIdentity.swift */,
6EC40A13214DFB5800BE4F17 /* Model.swift */,
6EC40A0F214DE3B200BE4F17 /* Executable.swift */,
Expand Down Expand Up @@ -391,9 +406,10 @@
files = (
34DED4D423FDCAFD00C53FB9 /* SwiftyCMSDecoder.swift in Sources */,
5F95AE262315A7CB002E0A22 /* TCCProfileImporterTests.swift in Sources */,
59206D6925265F0C00B94795 /* TCCProfileTests.swift in Sources */,
5901A2772534DF1400A1CD2F /* ModelBuilder.swift in Sources */,
59798B82252D16310070A204 /* TCCProfileBuilder.swift in Sources */,
5F90EBE42319992B00738D09 /* ModelTests.swift in Sources */,
34DED4D323FDC77E00C53FB9 /* TCCProfile.swift in Sources */,
345B01D723FDBF55008838B6 /* TCCProfileExtensions.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -454,18 +470,19 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = XPLDEEDNHE;
INFOPLIST_FILE = "PPPC UtilityTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_BUNDLE_IDENTIFIER = "com.jamf.PPPC-UtilityTests";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PPPC Utility.app/Contents/MacOS/PPPC Utility";
Expand All @@ -477,18 +494,19 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = XPLDEEDNHE;
INFOPLIST_FILE = "PPPC UtilityTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_BUNDLE_IDENTIFIER = "com.jamf.PPPC-UtilityTests";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PPPC Utility.app/Contents/MacOS/PPPC Utility";
};
Expand Down Expand Up @@ -544,7 +562,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
IBSC_NOTICES = NO;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -598,7 +617,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
IBSC_NOTICES = NO;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
Expand All @@ -612,16 +632,17 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "Resources/PPPC Utility.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
DEVELOPMENT_TEAM = XPLDEEDNHE;
ENABLE_HARDENED_RUNTIME = NO;
INFOPLIST_FILE = Resources/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.2.1;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = com.jamf.opensource.pppcutility;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -634,16 +655,17 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "Resources/PPPC Utility.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = XPLDEEDNHE;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = Resources/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.2.1;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = com.jamf.opensource.pppcutility;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
53 changes: 53 additions & 0 deletions PPPC UtilityTests/Helpers/ModelBuilder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// ModelBuilder.swift
//
// MIT License
//
// Copyright (c) 2019 Jamf Software
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//

import Cocoa

@testable import PPPC_Utility

class ModelBuilder {

var model: Model

init() {
model = Model()
}

func build() -> Model {
return model
}

func addExecutable(settings: [String: String]) -> ModelBuilder {
let exe = Executable(identifier: "id", codeRequirement: "req", "display")
settings.forEach { key, value in
exe.policy.setValue(value, forKey: key)
}
model.selectedExecutables.append(exe)

return self
}

}
74 changes: 74 additions & 0 deletions PPPC UtilityTests/Helpers/TCCProfileBuilder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//
// TCCProfileBuilder.swift
//
// MIT License
//
// Copyright (c) 2019 Jamf Software
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//

import Cocoa

@testable import PPPC_Utility

class TCCProfileBuilder: NSObject {

// MARK: - build testing objects

func buildTCCPolicy(allowed: Bool?, authorization: TCCPolicyAuthorizationValue?) -> TCCPolicy {
var policy = TCCPolicy(identifier: "policy id", codeRequirement: "policy code req",
receiverIdentifier: "policy receiver id", receiverCodeRequirement: "policy receiver code req")
policy.comment = "policy comment"
policy.identifierType = "policy id type"
policy.receiverIdentifierType = "policy receiver id type"
policy.allowed = allowed
policy.authorization = authorization
return policy
}

func buildTCCPolicies(allowed: Bool?, authorization: TCCPolicyAuthorizationValue?) -> [String: [TCCPolicy]] {
return ["SystemPolicyAllFiles": [buildTCCPolicy(allowed: allowed, authorization: authorization)],
"AppleEvents": [buildTCCPolicy(allowed: allowed, authorization: authorization)]]
}

func buildTCCContent(_ contentIndex: Int, allowed: Bool?, authorization: TCCPolicyAuthorizationValue?) -> TCCProfile.Content {
return TCCProfile.Content(payloadDescription: "Content Desc \(contentIndex)",
displayName: "Content Name \(contentIndex)",
identifier: "Content ID \(contentIndex)",
organization: "Content Org \(contentIndex)",
type: "Content type \(contentIndex)",
uuid: "Content UUID \(contentIndex)",
version: contentIndex,
services: buildTCCPolicies(allowed: allowed, authorization: authorization))
}

func buildProfile(allowed: Bool? = nil, authorization: TCCPolicyAuthorizationValue? = nil) -> TCCProfile {
var profile = TCCProfile(organization: "Test Org",
identifier: "Test ID",
displayName: "Test Name",
payloadDescription: "Test Desc",
services: [:])
profile.content = [buildTCCContent(1, allowed: allowed, authorization: authorization)]
profile.version = 100
profile.uuid = "the uuid"
return profile
}

}
Loading

0 comments on commit 9878cc2

Please sign in to comment.