Check study access rights and study exists

 Fix #445
Can you please use the functions we already have for this? `user.private_studies`, `user.shared_studies`, and `study.get_public`?