core-5353 fix sharing UI. refactor code to user permissions enum.