Allowing Mediapartners-google, denying others

Anyone have any examples that will disallow all robots, except
mediapartners-google.

Also, my site is password protected, but I'd like to allow
mediapartners-google to view condensed versions of the content, how
can I check to see if that's the user trying to view in?