def test_dataset_group_rights_gives_access_to_all_datasets( db, user, dataset_wrapper): add_group_perm_to_user("A", user) add_group_perm_to_dataset("A", dataset_wrapper.study_id) assert user_has_permission(user, "Dataset1") assert user_has_permission(user, "Dataset2") assert user_has_permission(user, "Dataset")
def test_dataset1_group_rights_gives_access_to_study1_and_study3( db, user, dataset_wrapper): add_group_perm_to_user("A", user) add_group_perm_to_dataset("A", "Dataset1") assert user_has_permission(user, "Study1") assert user_has_permission(user, "Study3") assert not user_has_permission(user, "Study2")
def test_dataset_admin_group_rights(db, user, dataset_wrapper): add_group_perm_to_user("admin", user) assert user_has_permission(user, dataset_wrapper.study_id) result = _get_allowed_datasets_for_user(user, dataset_wrapper.study_id) assert result == set(["Dataset"]) result = get_allowed_genotype_studies(user, dataset_wrapper.study_id) assert result == set(["Study1", "Study2", "Study3"])
def get(self, request, common_report_id): report = self.gpf_instance.get_common_report(common_report_id) if not report: return Response(status=status.HTTP_404_NOT_FOUND) if not user_has_permission(request.user, common_report_id): return Response(status=status.HTTP_403_FORBIDDEN) families_data = self.gpf_instance.get_common_report_families_data( common_report_id) if not families_data: return Response(status=status.HTTP_404_NOT_FOUND) response = StreamingHttpResponse(families_data, content_type="text/tsv") response["Content-Disposition"] = "attachment; filename=families.ped" response["Expires"] = "0" return response
def test_dataset_rights(db, user, dataset_wrapper): add_group_perm_to_user(dataset_wrapper.study_id, user) assert user_has_permission(user, dataset_wrapper.study_id)
def test_dataset1_group_rights(db, user, dataset_wrapper): add_group_perm_to_user("A", user) add_group_perm_to_dataset("A", "Dataset1") assert user_has_permission(user, dataset_wrapper.study_id)
def augment_accessibility(self, dataset, user): dataset_object = Dataset.objects.get(dataset_id=dataset["id"]) dataset["access_rights"] = user_has_permission(user, dataset_object) return dataset