PEP8 (wrap at 80 chars and spaces around equal signs)
PEP8, spaces around equal signs
Raise unauthorized when user doesn't have permission.

Results in a better status message than "No valid data".
Use portal_actions tool to help determine which actions should be shown

This fixes the problem that the "paste" action was shown in places where the
user couldn't actually paste.

Also added some tests.