The MacEnterprise list has discussed this topic recently, Forcing Log-Off For Idle Users.
John NcNair suggested the following
defaults write /Library/Preferences/.GlobalPreferences com.apple.autologout.AutoLogOutDelay -int 900
defaults write /Library/Preferences/.GlobalPreferences com.apple.securitypref.logoutvalue -int 900
Bruce Carter mentioned...
Note that nothing using Apple's internal mechanism for this will work if
the user has unsaved files open. It will simply stop at the dialog box and
See the related question How can I automatically log out the guest account after a period of inactivity? for other approaches and tools.