Check study access rights and study exists

 Fix #445
Those are in case the study doesn't exist.