Skip to content

Commit

Permalink
implemented [Feature Request] AD - Option to hide Sign-In menu item #150
Browse files Browse the repository at this point in the history
  • Loading branch information
twocanoes committed Feb 13, 2024
1 parent a9f5ccc commit 629dfe1
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 11 deletions.
20 changes: 18 additions & 2 deletions Profile Manifest/com.twocanoes.xcreds.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<key>pfm_app_url</key>
<string>https://github.com/twocanoes/xcreds</string>
<key>pfm_description</key>
<string>XCreds 4.1 (6342) OAuth Settings</string>
<string>XCreds 4.1 (6344) OAuth Settings</string>
<key>pfm_documentation_url</key>
<string>https://twocanoes.com/knowledge-base/xcreds-admin-guide/#preferences</string>
<key>pfm_domain</key>
<string>com.twocanoes.xcreds</string>
<key>pfm_format_version</key>
<integer>1</integer>
<key>pfm_last_modified</key>
<date>2024-02-13T19:51:33Z</date>
<date>2024-02-13T20:04:02Z</date>
<key>pfm_platforms</key>
<array>
<string>macOS</string>
Expand Down Expand Up @@ -559,6 +559,22 @@ Note that Google does not support the offline_access scope so instead use the pr
<key>pfm_type</key>
<string>boolean</string>
</dict>
<dict>
<key>pfm_default</key>
<true/>
<key>pfm_description</key>
<string>Determine if the Sign In menu item is shown in the XCreds menu. When not set or set to true, show Sign In. If false, the Sign In menu item is hidden.</string>
<key>pfm_documentation_url</key>
<string>https://twocanoes.com/knowledge-base/xcreds-admin-guide/#preferences</string>
<key>pfm_name</key>
<string>shouldShowSignInMenuItem</string>
<key>pfm_title</key>
<string>Show Sign In Menu Item</string>
<key>pfm_type</key>
<string>boolean</string>
<key>pfm_default</key>
<true/>
</dict>
<dict>
<key>pfm_default</key>
<false/>
Expand Down
2 changes: 1 addition & 1 deletion XCreds/PrefKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation

enum PrefKeys: String {
case clientID, clientSecret, password="xcreds local password",discoveryURL, redirectURI, scopes, accessToken, idToken, refreshToken, tokenEndpoint, expirationDate, invalidToken, refreshRateHours,refreshRateMinutes, showDebug, verifyPassword, shouldShowQuitMenu, shouldShowPreferencesOnStart, shouldSetGoogleAccessTypeToOffline, passwordChangeURL, shouldShowAboutMenu, username, idpHostName, passwordElementID, shouldFindPasswordElement, shouldShowVersionInfo, shouldShowSupportStatus,shouldShowConfigureWifiButton,shouldShowMacLoginButton, loginWindowBackgroundImageURL, shouldShowCloudLoginByDefault, shouldPreferLocalLoginInsteadOfCloudLogin, idpHostNames,autoRefreshLoginTimer, loginWindowWidth, loginWindowHeight, shouldShowRefreshBanner, shouldSwitchToLoginWindowWhenLocked,accounts = "Accounts",
windowSignIn = "WindowSignIn", settingsOverrideScriptPath, localAdminUserName, localAdminPassword, usernamePlaceholder, passwordPlaceholder, shouldShowLocalOnlyCheckbox, shouldShowTokenUpdateStatus, shouldDetectNetworkToDetermineLoginWindow, showLoginWindowDelaySeconds, shouldPromptForMigration, shouldAllowKeyComboForMacLoginWindow, aliasName,claimsToAddToLocalUserAccount, loadPageTitle, loadPageInfo,shouldPromptForADPasswordChange, hideIfPathExists, allowedUsersArray, allowUsersClaim, mapKerberosPrincipalName, mapFirstName = "map_firstname",mapFullName = "map_fullname", mapUserName = "map_username", mapLastName = "map_lastname",menuItemWindowBackgroundImageURL, menuItems, shareMenuItemName
windowSignIn = "WindowSignIn", settingsOverrideScriptPath, localAdminUserName, localAdminPassword, usernamePlaceholder, passwordPlaceholder, shouldShowLocalOnlyCheckbox, shouldShowTokenUpdateStatus, shouldDetectNetworkToDetermineLoginWindow, showLoginWindowDelaySeconds, shouldPromptForMigration, shouldAllowKeyComboForMacLoginWindow, aliasName,claimsToAddToLocalUserAccount, loadPageTitle, loadPageInfo,shouldPromptForADPasswordChange, hideIfPathExists, allowedUsersArray, allowUsersClaim, mapKerberosPrincipalName, mapFirstName = "map_firstname",mapFullName = "map_fullname", mapUserName = "map_username", mapLastName = "map_lastname",menuItemWindowBackgroundImageURL, menuItems, shareMenuItemName, shouldShowSignInMenuItem
case shouldUseROPGForPasswordChangeChecking
case shouldUseROPGForMenuLogin
case shouldUseROPGForLoginWindowLogin
Expand Down
10 changes: 9 additions & 1 deletion XCreds/StatusMenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,15 @@ class StatusMenuController: NSObject, NSMenuItemValidation {

case .SignInMenuItem:
print("SignInMenuItem")

if DefaultsOverride.standardOverride.bool(forKey: PrefKeys.shouldShowSignInMenuItem.rawValue) == false {

signinMenuItem.isHidden=true
return false
}
signinMenuItem.isHidden=false




case .ChangePasswordMenuItem:

Expand Down
2 changes: 2 additions & 0 deletions XCreds/defaults.plist
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,7 @@
<string>upn</string>
<key>shareMenuItemName</key>
<string>Shares</string>
<key>shouldShowSignInMenuItem</key>
<true/>
</dict>
</plist>
14 changes: 7 additions & 7 deletions xCreds.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@
7659CA06298E1BB6005D1AA3 /* DefaultBackground.png */,
766FD60C2A1B06AC00C8F244 /* DefaultsOverride.swift */,
7675444428918CD100613840 /* Info.plist */,
76DD6D15285997F300A700ED /* Frameworks */,
76CB9076287FBEEA00C70D0C /* Helper+URLDecode.swift */,
76B040A328EFC788002A289B /* Helper+JWTDecode.swift */,
7632909B2876673500CF8857 /* DataExtension.swift */,
Expand All @@ -809,7 +810,6 @@
76786F542A27C36A00AA8DB9 /* auth_mech_fixup */,
76786F642A27C62D00AA8DB9 /* test */,
76EE069B27FD1D00009E0F3A /* Products */,
76DD6D15285997F300A700ED /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -1440,7 +1440,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6342;
CURRENT_PROJECT_VERSION = 6344;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1477,7 +1477,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6342;
CURRENT_PROJECT_VERSION = 6344;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1598,7 +1598,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6342;
CURRENT_PROJECT_VERSION = 6344;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1635,7 +1635,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6342;
CURRENT_PROJECT_VERSION = 6344;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1785,7 +1785,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6342;
CURRENT_PROJECT_VERSION = 6344;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1827,7 +1827,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6342;
CURRENT_PROJECT_VERSION = 6344;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
Binary file not shown.

0 comments on commit 629dfe1

Please sign in to comment.