Best way I can think to do this is:
Open System Preferences
Open Security
Check the box that says "Require password to wake this computer from sleep or screen saver."
Then if you put the computer to sleep or start the screensaver, people can access your computer without the password.