1011015: Check if definitions are publishable server side

Check if definitions are publishable before publishing. Also check if views are
refreshable before refreshing. Fixes #2857.