Skip to content

Commit 89bb02e

Browse files
committed
Uploading Privileges 2.2 source code
1 parent 555ed36 commit 89bb02e

File tree

14 files changed

+643
-91
lines changed

14 files changed

+643
-91
lines changed

source/Privileges.xcodeproj/project.pbxproj

Lines changed: 50 additions & 36 deletions
Large diffs are not rendered by default.

source/Privileges/Privileges.mobileconfig

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,18 @@
119119
<key>AllowCLIBiometricAuthentication</key>
120120
<true/>
121121

122+
<!--
123+
key: EnableSmartCardSupport
124+
value: a boolean
125+
126+
Specifies whether to enable smart card support for authentication. Since
127+
the modern Local Authentication framework does not yet support smart
128+
cards/PIV tokens, enabling this option will cause the application to
129+
fall back to the older Authorization Services.
130+
-->
131+
<key>EnableSmartCardSupport</key>
132+
<true/>
133+
122134
<!--
123135
key: PostChangeExecutablePath
124136
value: a string containing the absolute path to an application or script
@@ -448,7 +460,7 @@
448460
value: a dictionary containing syslog-specific options:
449461
450462
key: ServerPort
451-
value: a integer specifying the port of the logging server.
463+
value: an integer specifying the port of the logging server
452464
453465
If not specified, the port defaults to 514 or to 6514 if TLS is enabled.
454466

source/PrivilegesAgent/AppDelegate.m

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -685,15 +685,12 @@ - (void)showStatusItem:(BOOL)status
685685
} else {
686686

687687
if (_statusItem) {
688-
689-
// remove our observer
690-
[_statusItem removeObserver:self forKeyPath:@"visible" context:nil];
691-
_observingStatusItem = NO;
692-
688+
693689
// remove the status item
694690
[[NSStatusBar systemStatusBar] removeStatusItem:_statusItem];
695-
_statusItem = nil;
696691
_statusMenu = nil;
692+
_statusItem = nil;
693+
_observingStatusItem = NO;
697694
}
698695
}
699696
}
@@ -945,12 +942,29 @@ - (void)renewAdminRightsWithCompletionHandler:(void(^)(BOOL success))completionH
945942
- (void)authenticateUserWithCompletionHandler:(void(^)(BOOL success))completionHandler
946943
{
947944
if (![[_privilegesApp currentUser] useIsRestricted]) {
948-
949-
[MTIdentity authenticateUserWithReason:[NSString localizedStringWithFormat:NSLocalizedString(@"authenticationText", nil), [[_privilegesApp currentUser] userName]]
950-
completionHandler:^(BOOL success, NSError *error) {
945+
946+
if ([_privilegesApp smartCardSupportEnabled]) {
951947

952-
if (completionHandler) { completionHandler(success); }
953-
}];
948+
NSString *reasonString = [NSString localizedStringWithFormat:NSLocalizedString(@"authenticationTextPIV", nil), kMTAppName,
949+
[NSString localizedStringWithFormat:NSLocalizedString(@"authenticationText", nil), [[_privilegesApp currentUser] userName]]
950+
];
951+
952+
[MTIdentity authenticatePIVUserWithReason:reasonString
953+
completionHandler:^(BOOL success, NSError *error) {
954+
955+
if (completionHandler) { completionHandler(success); }
956+
}];
957+
958+
} else {
959+
960+
NSString *reasonString = [NSString localizedStringWithFormat:NSLocalizedString(@"authenticationText", nil), [[_privilegesApp currentUser] userName]];
961+
962+
[MTIdentity authenticateUserWithReason:reasonString
963+
completionHandler:^(BOOL success, NSError *error) {
964+
965+
if (completionHandler) { completionHandler(success); }
966+
}];
967+
}
954968

955969
} else {
956970

source/PrivilegesAgent/Classes/MTStatusItemMenu.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ - (void)updateMenu
6060
}
6161

6262
[[self itemWithTag:1000] setEnabled:!([[privilegesApp currentUser] useIsRestricted] || (!hasAdminPrivileges && [privilegesApp reasonRequired]))];
63-
[[self itemWithTag:2000] setAlternate:(hasAdminPrivileges && [privilegesApp privilegeRenewalAllowed])];
63+
[[self itemWithTag:2000] setAlternate:(hasAdminPrivileges && [privilegesApp privilegeRenewalAllowed] && [privilegesApp expirationInterval] > 0)];
6464
[[self itemWithTag:2000] setHidden:![[self itemWithTag:2000] isAlternate]];
6565
}
6666

source/PrivilegesAgent/Localizable.xcstrings

Lines changed: 253 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"sourceLanguage" : "en",
33
"strings" : {
44
"authenticationText" : {
5-
"comment" : "A text that displays in the authentication dialog presented to the user. It is prefixed automatically the app name. The variable will contain the user name. Please use the file \"authenticationTextHelp.txt\" to look up the structure of the sentence in the respective language.",
5+
"comment" : "A text that displays in the authentication dialog presented to the user. It is prefixed automatically the app name. The variable will contain the user name.",
66
"extractionState" : "manual",
77
"localizations" : {
88
"ar" : {
@@ -104,7 +104,7 @@
104104
"hi" : {
105105
"stringUnit" : {
106106
"state" : "translated",
107-
"value" : "उपयोगकर्ता % के लिए व्यवस्थापक विशेषाधिकार प्रदान करने के लिए @"
107+
"value" : "उपयोगकर्ता %@ के लिए व्यवस्थापक विशेषाधिकार प्रदान करने के लिए"
108108
}
109109
},
110110
"hr" : {
@@ -253,6 +253,257 @@
253253
}
254254
}
255255
},
256+
"authenticationTextPIV" : {
257+
"comment" : "We use this temporarily until Local Authentication supports smart cards/PIV tokens. This turns the substring used by Local Authentication into a full string again.",
258+
"localizations" : {
259+
"ar" : {
260+
"stringUnit" : {
261+
"state" : "translated",
262+
"value" : "ول تطبيق %@ %@."
263+
}
264+
},
265+
"bg-BG" : {
266+
"stringUnit" : {
267+
"state" : "translated",
268+
"value" : "%1$@ се опитва %2$@."
269+
}
270+
},
271+
"ca" : {
272+
"stringUnit" : {
273+
"state" : "translated",
274+
"value" : "L’app %1$@ vol %2$@."
275+
}
276+
},
277+
"cs" : {
278+
"stringUnit" : {
279+
"state" : "translated",
280+
"value" : "%1$@ se pokouší %2$@."
281+
}
282+
},
283+
"da" : {
284+
"stringUnit" : {
285+
"state" : "translated",
286+
"value" : "%1$@ prøver at %2$@."
287+
}
288+
},
289+
"de" : {
290+
"stringUnit" : {
291+
"state" : "translated",
292+
"value" : "Die App „%1$@“ möchte %2$@."
293+
}
294+
},
295+
"el" : {
296+
"stringUnit" : {
297+
"state" : "translated",
298+
"value" : "Απόπειρα από «%1$@» για %2$@."
299+
}
300+
},
301+
"en" : {
302+
"stringUnit" : {
303+
"state" : "translated",
304+
"value" : "%1$@ is trying to %2$@."
305+
}
306+
},
307+
"en-AU" : {
308+
"stringUnit" : {
309+
"state" : "translated",
310+
"value" : "%1$@ is trying to %2$@."
311+
}
312+
},
313+
"en-GB" : {
314+
"stringUnit" : {
315+
"state" : "translated",
316+
"value" : "%1$@ is trying to %2$@."
317+
}
318+
},
319+
"es" : {
320+
"stringUnit" : {
321+
"state" : "translated",
322+
"value" : "La app %1$@ está intentando %2$@."
323+
}
324+
},
325+
"es-419" : {
326+
"stringUnit" : {
327+
"state" : "translated",
328+
"value" : "%1$@ está intentando %2$@."
329+
}
330+
},
331+
"fi" : {
332+
"stringUnit" : {
333+
"state" : "translated",
334+
"value" : "%1$@ yrittää %2$@."
335+
}
336+
},
337+
"fr" : {
338+
"stringUnit" : {
339+
"state" : "translated",
340+
"value" : "L’app %1$@ souhaite %2$@."
341+
}
342+
},
343+
"fr-CA" : {
344+
"stringUnit" : {
345+
"state" : "translated",
346+
"value" : "%1$@ souhaite %2$@."
347+
}
348+
},
349+
"he" : {
350+
"stringUnit" : {
351+
"state" : "translated",
352+
"value" : "״%@״ מנסה %@."
353+
}
354+
},
355+
"hi" : {
356+
"stringUnit" : {
357+
"state" : "translated",
358+
"value" : "%1$@ %2$@ का अनुरोध कर रहा है।"
359+
}
360+
},
361+
"hr" : {
362+
"stringUnit" : {
363+
"state" : "translated",
364+
"value" : "%1$@ pokušava %2$@."
365+
}
366+
},
367+
"hu" : {
368+
"stringUnit" : {
369+
"state" : "translated",
370+
"value" : "A(z) %1$@ a következővel próbálkozik: %2$@."
371+
}
372+
},
373+
"id" : {
374+
"stringUnit" : {
375+
"state" : "translated",
376+
"value" : "%1$@ mencoba untuk %2$@."
377+
}
378+
},
379+
"it" : {
380+
"stringUnit" : {
381+
"state" : "translated",
382+
"value" : "%1$@ sta cercando di %2$@."
383+
}
384+
},
385+
"ja" : {
386+
"stringUnit" : {
387+
"state" : "translated",
388+
"value" : "%1$@で次の操作を実行しようとしています: %2$@"
389+
}
390+
},
391+
"ko" : {
392+
"stringUnit" : {
393+
"state" : "translated",
394+
"value" : "%1$@에서 다음 동작을 시도함: %2$@"
395+
}
396+
},
397+
"ms" : {
398+
"stringUnit" : {
399+
"state" : "translated",
400+
"value" : "%1$@ sedang cuba %2$@."
401+
}
402+
},
403+
"nb" : {
404+
"stringUnit" : {
405+
"state" : "translated",
406+
"value" : "«%1$@» prøver å %2$@."
407+
}
408+
},
409+
"nl" : {
410+
"stringUnit" : {
411+
"state" : "translated",
412+
"value" : "%1$@ probeert %2$@."
413+
}
414+
},
415+
"pl" : {
416+
"stringUnit" : {
417+
"state" : "translated",
418+
"value" : "%1$@ próbuje %2$@."
419+
}
420+
},
421+
"pt-BR" : {
422+
"stringUnit" : {
423+
"state" : "translated",
424+
"value" : "%1$@ está tentando %2$@."
425+
}
426+
},
427+
"pt-PT" : {
428+
"stringUnit" : {
429+
"state" : "translated",
430+
"value" : "%1$@ está a tentar %2$@."
431+
}
432+
},
433+
"ro" : {
434+
"stringUnit" : {
435+
"state" : "translated",
436+
"value" : "%1$@ încearcă să %2$@."
437+
}
438+
},
439+
"ru" : {
440+
"stringUnit" : {
441+
"state" : "translated",
442+
"value" : "Приложение «%1$@» собирается %2$@."
443+
}
444+
},
445+
"sk" : {
446+
"stringUnit" : {
447+
"state" : "translated",
448+
"value" : "„%1$@“ sa pokúša %2$@."
449+
}
450+
},
451+
"sl" : {
452+
"stringUnit" : {
453+
"state" : "translated",
454+
"value" : "%1$@ poskuša %2$@."
455+
}
456+
},
457+
"sv" : {
458+
"stringUnit" : {
459+
"state" : "translated",
460+
"value" : "%1$@ försöker att %2$@."
461+
}
462+
},
463+
"th" : {
464+
"stringUnit" : {
465+
"state" : "translated",
466+
"value" : "%[tt]@กำลังพยายามที่จะ%[tt]@"
467+
}
468+
},
469+
"tr" : {
470+
"stringUnit" : {
471+
"state" : "translated",
472+
"value" : "%1$@, %2$@."
473+
}
474+
},
475+
"uk" : {
476+
"stringUnit" : {
477+
"state" : "translated",
478+
"value" : "Програма «%1$@» намагається %2$@."
479+
}
480+
},
481+
"vi" : {
482+
"stringUnit" : {
483+
"state" : "translated",
484+
"value" : "%1$@ đang cố gắng %2$@."
485+
}
486+
},
487+
"zh-Hans" : {
488+
"stringUnit" : {
489+
"state" : "translated",
490+
"value" : "%[tt]@正在尝试%@。"
491+
}
492+
},
493+
"zh-Hant" : {
494+
"stringUnit" : {
495+
"state" : "translated",
496+
"value" : "%[tt]@正在嘗試%@。"
497+
}
498+
},
499+
"zh-HK" : {
500+
"stringUnit" : {
501+
"state" : "translated",
502+
"value" : "%[tt]@正在嘗試%@。"
503+
}
504+
}
505+
}
506+
},
256507
"notificationMessage_Error" : {
257508
"localizations" : {
258509
"ar" : {

0 commit comments

Comments
 (0)