@@ -39,7 +39,7 @@ class UserInfo: ObservableObject {
3939 @Published var networkUnavailable : Bool = false
4040
4141 // Full name of macOS user account
42- @ Published var fullName : String = " "
42+ var fullName : String = NSFullUserName ( )
4343
4444 // Array of detected Kerberos Realms
4545 var realmsArray : [ String ] = [ ]
@@ -443,53 +443,6 @@ class UserInfo: ObservableObject {
443443 logger. debug ( " Pasword Expiry Limit did not change, no need to reload StatusBarItem " )
444444 }
445445 }
446-
447- // MARK: - Function to get the user record and full name
448- func getUserFullName( ) {
449-
450- // Skip if user's full name is already available
451- guard fullName. isEmpty else {
452- return
453- }
454-
455- DispatchQueue . global ( ) . async { [ self ] in
456- do {
457- let node = try ODNode . init ( session: session, type: UInt32 ( kODNodeTypeAuthentication) )
458- // let node = try ODNode.init(session: session, type: UInt32(kODNodeTypeLocalNodes))
459- let query = try ODQuery . init ( node: node, forRecordTypes: kODRecordTypeUsers, attribute: kODAttributeTypeRecordName, matchType: UInt32 ( kODMatchEqualTo) , queryValues: currentConsoleUserName, returnAttributes: kODAttributeTypeNativeOnly, maximumResults: 0 )
460- records = try query. resultsAllowingPartial ( false ) as! [ ODRecord ]
461- } catch {
462- logger. error ( " Unable to get local user account ODRecords " )
463- }
464- }
465-
466- // We may have gotten multiple ODRecords that match username,
467- // So make sure it also matches the UID.
468-
469- // Perform on background thread
470- DispatchQueue . global ( ) . async { [ self ] in
471-
472- for case let record in records {
473- let attribute = " dsAttrTypeStandard:UniqueID "
474- if let odUid = try ? String ( describing: record. values ( forAttribute: attribute) [ 0 ] ) {
475- if ( odUid == uid) {
476-
477- do {
478- let fullNameArray = try record. values ( forAttribute: kODAttributeTypeFullName) as? [ String ]
479- DispatchQueue . main. async {
480- self . fullName = fullNameArray? . first ?? " "
481- self . logger. debug ( " Full name is: \( self . fullName, privacy: . public) " )
482- }
483- } catch {
484- logger. error ( " Error while getting user's full name " )
485- logger. error ( " \( error. localizedDescription) " )
486- }
487-
488- }
489- }
490- }
491- }
492- }
493446
494447 // MARK: - Expirimental function to change the local Mac password
495448 func changePassword( ) {
0 commit comments