This is not a out-of-the-box solution but it will possibly work if no one other comes up with a solution :-)
You can manipulate the power management settings with the command
pmset. See the manpage for more information about it.
The interesting setting we want to manipulate is sleep:
sleep - system sleep timer (value in
minutes, or 0 to disable)
So we can use the following commands:
sudo pmset sleep 25 # go to sleep after 25 minutes
sudo pmset sleep 0 # disable sleep
Now we have to trigger these commands after a login and logut. If I remember this right, Bash is the default shell for Mac OS X which brings us to these two files:
The personal initialization file, executed for login shells
The individual login shell cleanup file, executed when a login shell exits
Edit or create them in your home directory and add the appropriate commands.
If you want, save the current sleep value in a temporary file and restore it from it afterwards.
The last problem to solve is the password prompt of sudo. To give your user the permission to invoke pmset without any password, edit your /etc/sudoers with sudoedit.
You need to use the
NOPASSWD tag. If this is new for you, have a look at the sudoers manual.