-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #681 from lindegroup/1.6-dev
1.6 dev
- Loading branch information
Showing
71 changed files
with
3,523 additions
and
896 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// LGJamfUploaderIntegration.h | ||
// AutoPkgr | ||
// | ||
// Copyright 2022 The Linde Group. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#import "LGDefaults.h" | ||
#import "LGConstants.h" | ||
#import "LGIntegration+Protocols.h" | ||
#import "LGIntegration.h" | ||
|
||
@class LGHTTPCredential; | ||
|
||
@interface LGJamfUploaderIntegration : LGIntegration | ||
|
||
@end | ||
|
||
#pragma mark - LGDefaults extensions for JamfUploader Interface | ||
@interface LGJamfUploaderDefaults : LGDefaults | ||
|
||
+ (instancetype)standardUserDefaults __attribute__((unavailable("Cannot use the shared object in this subclass."))); | ||
|
||
@property (copy, nonatomic) NSString *JSSURL; | ||
@property (copy, nonatomic) NSString *JSSAPIUsername; | ||
@property (copy, nonatomic) NSString *JSSAPIPassword; | ||
@property (copy, nonatomic) NSArray *JSSRepos; | ||
@property (assign, nonatomic) BOOL JSSVerifySSL; | ||
|
||
@end |
194 changes: 194 additions & 0 deletions
194
AutoPkgr/Models/Integrations/LGJamfUploaderIntegration.m
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 |
---|---|---|
@@ -0,0 +1,194 @@ | ||
// | ||
// LGJamfUploaderIntegration.m | ||
// AutoPkgr | ||
// | ||
// Copyright 2022 The Linde Group. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#import "LGIntegration+Protocols.h" | ||
#import "LGJamfUploaderIntegration.h" | ||
#import "LGLogger.h" | ||
#import "LGServerCredentials.h" | ||
#import <Foundation/Foundation.h> | ||
|
||
@interface LGJamfUploaderIntegration () <LGIntegrationSharedProcessor> | ||
@end | ||
|
||
@implementation LGJamfUploaderIntegration | ||
|
||
@synthesize gitHubInfo = _gitHubInfo; | ||
@synthesize installedVersion = _installedVersion; | ||
|
||
#pragma mark - Class overrides | ||
+ (NSString *)name | ||
{ | ||
return @"JamfUploader"; | ||
} | ||
|
||
+ (NSString *)credits | ||
{ | ||
return @"Graham Pugh\nhttp://www.apache.org/licenses/LICENSE-2.0\nhttps://github.com/autopkg/grahampugh-recipes"; | ||
} | ||
|
||
+ (NSURL *)homePage | ||
{ | ||
return [NSURL URLWithString:@"https://github.com/autopkg/grahampugh-recipes"]; | ||
} | ||
|
||
+ (NSString *)gitHubURL | ||
{ | ||
return @"https://github.com/autopkg/grahampugh-recipes"; | ||
} | ||
|
||
+ (NSString *)defaultRepository | ||
{ | ||
return @"https://github.com/autopkg/grahampugh-recipes.git"; | ||
} | ||
|
||
+ (NSString *)binary | ||
{ | ||
static NSString *const jamfUploaderBinary = @"~/Library/AutoPkg/RecipeRepos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfUploaderLib/JamfUploaderBase.py"; | ||
return jamfUploaderBinary.stringByExpandingTildeInPath; | ||
} | ||
|
||
+ (NSArray *)components | ||
{ | ||
return @[ | ||
[self binary], | ||
]; | ||
} | ||
|
||
+ (NSArray *)packageIdentifiers | ||
{ | ||
return @[ @"com.github.autopkg.grahampugh-recipes"]; | ||
} | ||
|
||
+ (BOOL)isUninstallable | ||
{ | ||
return YES; | ||
} | ||
|
||
+ (NSArray *)summaryResultKey | ||
{ | ||
return @[ @"jamfcategoryuploader_summary_result", @"jamfcomputergroupuploader_summary_result", @"jamfdockitemuploader_summary_result", @"jamfextensionattributeuploader_summary_result", @"jamfpackageuploader_summary_result", @"jamfpatchuploader_summary_result", @"jamfpolicyuploader_summary_result", @"jamfscriptuploader_summary_result" ]; | ||
} | ||
|
||
#pragma mark - Instance overrides. | ||
|
||
- (NSString *)installedVersion | ||
{ | ||
NSFileManager *fm = [NSFileManager defaultManager]; | ||
|
||
NSString *receipt = @"~/Library/AutoPkg/RecipeRepos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfUploaderLib/JamfUploaderBase.py"; | ||
|
||
|
||
if ([[self class] isInstalled]) { | ||
if ([fm fileExistsAtPath:receipt]) { | ||
} | ||
_installedVersion = @"is"; | ||
} | ||
|
||
return _installedVersion; | ||
} | ||
|
||
- (void)customInstallActions:(void (^)(NSError *))reply | ||
{ | ||
LGJamfUploaderDefaults *defaults = [[LGJamfUploaderDefaults alloc] init]; | ||
NSNumber *verifySSL = [defaults autoPkgDomainObject:@"JSS_VERIFY_SSL"]; | ||
if (!verifySSL) { | ||
defaults.JSSVerifySSL = YES; | ||
} | ||
reply(nil); | ||
} | ||
|
||
- (void)customUninstallActions:(void (^)(NSError *))reply | ||
{ | ||
// Clear out the defaults. | ||
LGJamfUploaderDefaults *defaults = [[LGJamfUploaderDefaults alloc] init]; | ||
defaults.JSSAPIPassword = nil; | ||
defaults.JSSAPIUsername = nil; | ||
defaults.JSSRepos = nil; | ||
defaults.JSSURL = nil; | ||
|
||
reply(nil); | ||
} | ||
|
||
@end | ||
|
||
#pragma mark - LGDefaults category implementation for JamfUploader Interface | ||
|
||
@implementation LGJamfUploaderDefaults | ||
|
||
- (NSString *)JSSURL | ||
{ | ||
return [self autoPkgDomainObject:@"JSS_URL"]; | ||
} | ||
|
||
- (void)setJSSURL:(NSString *)JSSURL | ||
{ | ||
[self setAutoPkgDomainObject:JSSURL forKey:@"JSS_URL"]; | ||
} | ||
|
||
#pragma mark - | ||
- (NSString *)JSSAPIUsername | ||
{ | ||
return [self autoPkgDomainObject:@"API_USERNAME"]; | ||
} | ||
|
||
- (void)setJSSAPIUsername:(NSString *)JSSAPIUsername | ||
{ | ||
[self setAutoPkgDomainObject:JSSAPIUsername forKey:@"API_USERNAME"]; | ||
} | ||
|
||
#pragma mark - | ||
- (NSString *)JSSAPIPassword | ||
{ | ||
return [self autoPkgDomainObject:@"API_PASSWORD"]; | ||
} | ||
|
||
- (void)setJSSAPIPassword:(NSString *)JSSAPIPassword | ||
{ | ||
[self setAutoPkgDomainObject:JSSAPIPassword forKey:@"API_PASSWORD"]; | ||
} | ||
|
||
#pragma mark - | ||
- (NSArray *)JSSRepos | ||
{ | ||
return [self autoPkgDomainObject:@"JSS_REPOS"]; | ||
} | ||
|
||
- (void)setJSSRepos:(NSArray *)JSSRepos | ||
{ | ||
[self setAutoPkgDomainObject:JSSRepos forKey:@"JSS_REPOS"]; | ||
} | ||
|
||
#pragma mark - | ||
- (BOOL)JSSVerifySSL | ||
{ | ||
NSNumber *verifySSL = [self autoPkgDomainObject:@"JSS_VERIFY_SSL"]; | ||
if (verifySSL == nil) { | ||
return YES; | ||
} | ||
|
||
return [verifySSL boolValue]; | ||
} | ||
|
||
- (void)setJSSVerifySSL:(BOOL)JSSVerifySSL | ||
{ | ||
DevLog(@"Setting JSS_SSL_VERIFY to %@", JSSVerifySSL ? @"YES" : @"NO"); | ||
[self setAutoPkgDomainObject:@(JSSVerifySSL) forKey:@"JSS_VERIFY_SSL"]; | ||
} | ||
|
||
@end |
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// | ||
// LGJamfDistributionPoint.h | ||
// AutoPkgr | ||
// | ||
// Copyright 2022 The Linde Group. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
typedef NS_OPTIONS(NSInteger, JamfDistributionPointType) { | ||
kLGJamfTypeFromJamf = 1 << 0, | ||
kLGJamfTypeAFP = 1 << 1, | ||
kLGJamfTypeSMB = 1 << 2, | ||
kLGJamfTypeJDS = 1 << 3, | ||
kLGJamfTypeCDP = 1 << 4, | ||
kLGJamfTypeLocal = 1 << 5 | ||
}; | ||
|
||
extern NSString *const kLGJamfDistPointNameKey; | ||
extern NSString *const kLGJamfDistPointURLKey; | ||
extern NSString *const kLGJamfDistPointSharePointKey; | ||
extern NSString *const kLGJamfDistPointMountPointKey; | ||
extern NSString *const kLGJamfDistPointPortKey; | ||
extern NSString *const kLGJamfDistPointUserNameKey; | ||
extern NSString *const kLGJamfDistPointPasswordKey; | ||
extern NSString *const kLGJamfDistPointWorkgroupDomainKey; | ||
extern NSString *const kLGJamfDistPointTypeKey; | ||
|
||
// Corresponding type string in keyJamfInfoDict(). | ||
extern const NSString *kJamfTypeString; | ||
// Key used to indicate the array of required keys for a DP. | ||
extern const NSString *kJamfRequired; | ||
// Key used to indicate the array of optional keys for a DP. | ||
extern const NSString *kJamfOptional; | ||
|
||
@interface LGJamfDistributionPoint : NSObject | ||
// Dictionary to query for type string. | ||
// Corresponding values can be looked up using an NSNumber representation of JamfDistributionPointType as the key. | ||
+ (NSDictionary *)keyJamfInfoDict; | ||
|
||
+ (NSArray<LGJamfDistributionPoint *> *)enabledDistributionPoints; | ||
|
||
+ (void)getFromRemote:(void (^)(NSArray<LGJamfDistributionPoint *> *distPoints, NSError *error))distPoints; | ||
|
||
// The Dictionary representation of the Distribution Point object, suitable for writing to defaults. | ||
@property (copy, readonly) NSDictionary *representation; | ||
@property (copy) NSString *name; | ||
@property (copy) NSString *URL; | ||
@property (copy) NSString *mount_point; | ||
@property (copy) NSString *port; | ||
@property (copy) NSString *share_name; | ||
@property (copy) NSString *username; | ||
@property (copy) NSString *password; | ||
@property (copy) NSString *domain; | ||
@property (copy) NSString *typeString; | ||
@property JamfDistributionPointType type; | ||
|
||
- (BOOL)isEditable; | ||
|
||
// Initialize a distribution point using a dictionary. | ||
- (instancetype)initWithDictionary:(NSDictionary *)dict; | ||
- (instancetype)initWithType:(JamfDistributionPointType)type; | ||
- (instancetype)initWithTypeString:(NSString *)typeString; | ||
|
||
// Save or modify an existing distribution point to defaults. | ||
- (BOOL)save; | ||
|
||
// Remove a distribution point. | ||
- (BOOL)remove; | ||
|
||
@end |
Oops, something went wrong.