Check study access rights and study exists

 Fix #445
Is there any advantage on doing this vs. leaving it as it was before?