Kiosk Mac API - Preventing Users Logging Out

I am in the process of writing a Mac application (10.6 / 10.7) that authenticates users in an Active Directory domain before allowing them access to a computer (I was told that I cannot allow users to log in through traditional registration services). I have an authentication code in place, and now I'm trying to make this full-screen mode login window and cannot close.

The Apple Kiosk API mode ( here) seems very suitable for this, and I used it to bring the window to full screen mode, disable the docking station / menu bar / forced shutdown, etc., all of which work fine. The problem I am facing is that I cannot prevent users from just CMD + Q'ing from the application.

There is no point in restricting the kiosk mode application, when the user can simply exit it, so I assume that I have something missing. The following is an example of what I'm doing:

NSApplicationPresentationOptions options = NSApplicationPresentationHideMenuBar|NSApplicationPresentationHideDock| NSApplicationPresentationDisableHideApplication| NSApplicationPresentationDisableProcessSwitching| NSApplicationPresentationDisableAppleMenu| NSApplicationPresentationDisableForceQuit; [NSApp setPresentationOptions:options]; [[_window contentView] enterFullScreenMode:[NSScreen mainScreen] withOptions:nil]; 

Result: a full-screen window, a menu bar, a docking station cannot force-quit and cannot display CMD + Tab on the screen. CMD + Q is still leaving the application.

+4
source share
1 answer

I suppose that he found the same solution as I did, but since I did not actually answer him, I thought I would tell you in detail.

What you need to do is implement the following NSApplicationDelegate method:

 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender 

And then return NSTerminateCancel here when your application is in kiosk mode.

+4
source

All Articles