Permalink
Browse files

for UseNotificationCenterDays preference, munki-notifier will use a m…

…anaged preference value if present, else fall back to reading the value from /Library/Preferences/ManagedInstalls.plist (ignoring user-level preferences)
  • Loading branch information...
gregneagle committed Nov 17, 2017
1 parent 293a707 commit 1aef2ca01946a4090f80c6c5c91f2a04be746da5
Showing with 11 additions and 2 deletions.
  1. +11 −2 code/apps/munki-notifier/munki-notifier/AppDelegate.m
@@ -114,11 +114,20 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification;
if (plistRef && CFGetTypeID(plistRef) == CFNumberGetTypeID()) {
oldestUpdateDays = [(NSNumber *)CFBridgingRelease(plistRef) floatValue];
}
plistRef = CFPreferencesCopyValue(
CFSTR("UseNotificationCenterDays"), CFSTR("ManagedInstalls"), kCFPreferencesAnyUser, kCFPreferencesCurrentHost);
if (CFPreferencesAppValueIsForced(CFSTR("UseNotificationCenterDays"), CFSTR("ManagedInstalls"))) {
// use CFPreferencesCopyAppValue so we can respect managed preferences
plistRef = CFPreferencesCopyAppValue(
CFSTR("UseNotificationCenterDays"), CFSTR("ManagedInstalls"));
} else {
// preference not managed, read from /Library/Preferences (ignoring user-level preferences)
plistRef = CFPreferencesCopyValue(
CFSTR("UseNotificationCenterDays"), CFSTR("ManagedInstalls"),
kCFPreferencesAnyUser, kCFPreferencesCurrentHost);
}
if (plistRef && CFGetTypeID(plistRef) == CFNumberGetTypeID()) {
useNotificationCenterDays = [(NSNumber *)CFBridgingRelease(plistRef) integerValue];
}
//NSLog(@"UseNotificationCenterDays: %ld", useNotificationCenterDays);
plistRef = CFPreferencesCopyValue(
CFSTR("ForcedUpdateDueDate"), CFSTR("ManagedInstalls"), kCFPreferencesAnyUser, kCFPreferencesCurrentHost);
if (plistRef && CFGetTypeID(plistRef) == CFDateGetTypeID()) {

0 comments on commit 1aef2ca

Please sign in to comment.