Move some permission checks from set_user_mode() to its callers.