Patches ported from Rails 2.
Permission updates.