Skip to content

Commit

Permalink
Merge pull request #95 from calabash/feature/match-profiles-with-wild…
Browse files Browse the repository at this point in the history
…card

Match array-based entitlements with * and <TEAM ID>.*
  • Loading branch information
jmoody authored Dec 2, 2016
2 parents 75a849c + a9cf921 commit 8290034
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
12 changes: 11 additions & 1 deletion iOSDeviceManager/Utilities/Entitlement.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ + (EntitlementComparisonResult)compareProfileEntitlement:(Entitlement *)profileE
NSArray *profArray = (NSArray *)profileEntitlement.value;

if (appArray.count > profArray.count) {
return ProfileDoesNotHaveRequiredKey;
if (profArray.count == 1) {
NSString *value = profArray[0];
if ([value isEqualToString:@"*"] ||
(value.length == 12 && [value hasSuffix:@"*"])) {
return ProfileHasKey;
} else {
return ProfileDoesNotHaveRequiredKey;
}
} else {
return ProfileDoesNotHaveRequiredKey;
}
} else if (appArray.count < profArray.count) {
// Prefer _less_ entitlements
return (profArray.count - appArray.count) * ProfileHasKey;
Expand Down
9 changes: 2 additions & 7 deletions iOSDeviceManager/Utilities/Entitlements.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#import "Entitlement.h"
#import "ConsoleWriter.h"

static NSString *const kAssociatedDomainsEntitlementKey = @"com.apple.developer.associated-domains";

@interface Entitlements ()

+ (NSDictionary *)dictionaryOfEntitlementsWithBundlePath:(NSString *)bundlePath;
Expand Down Expand Up @@ -74,23 +72,20 @@ + (Entitlements *)entitlementsWithDictionary:(NSDictionary *)dictionary {
+ (NSArray<NSString *> *)entitlementComparisonKeys {
return
@[
// Requires special matching.
kAssociatedDomainsEntitlementKey,

// String Values
@"com.apple.developer.ubiquity-kvstore-identifier",
@"com.apple.developer.icloud-services",
@"aps-environment",
@"com.apple.developer.default-data-protection",

// Array Values
@"com.apple.developer.associated-domains",
@"keychain-access-groups",
@"com.apple.security.application-groups",
@"com.apple.developer.in-app-payments",
@"com.apple.developer.pass-type-identifiers",
@"com.apple.developer.icloud-container-environment",
@"com.apple.developer.icloud-container-identifiers",
@"com.apple.developer.icloud-container-development-container-identifiers",
@"com.apple.developer.icloud-services",
@"com.apple.developer.ubiquity-container-identifiers",
@"com.apple.developer.networking.com.apple.developer.in-app-payments.api"
];
Expand Down

0 comments on commit 8290034

Please sign in to comment.