def f_can_delete_learning_unit_year(request, learning_unit_year_id): learn_unit_year = get_object_or_404( learning_unit_year.LearningUnitYear, pk=learning_unit_year_id) pers = get_object_or_404(Person, user=request.user) if not business_perms.is_eligible_to_delete_learning_unit_year( learn_unit_year, pers): raise PermissionDenied return view_func(request, learning_unit_year_id)
def test_when_existing_proposal_in_epc(self): luy = LearningUnitYearFactory( academic_year=self.academic_yr, learning_unit__existing_proposal_in_epc=True) self.assertFalse(perms.is_eligible_for_modification(luy, None)) self.assertFalse(perms.is_eligible_for_modification_end_date( luy, None)) self.assertFalse(perms.is_eligible_to_create_partim(luy, None)) self.assertFalse( perms.is_eligible_to_create_modification_proposal(luy, None)) self.assertFalse( perms.is_eligible_to_delete_learning_unit_year(luy, None))
def test_when_existing_proposal_in_epc(self): a_person = create_person_with_permission_and_group( CENTRAL_MANAGER_GROUP) luy = LearningUnitYearFactory( academic_year=self.academic_yr, learning_unit__existing_proposal_in_epc=True) self.assertFalse(perms.is_eligible_for_modification(luy, a_person)) self.assertFalse( perms.is_eligible_for_modification_end_date(luy, a_person)) self.assertFalse(perms.is_eligible_to_create_partim(luy, a_person)) self.assertFalse( perms.is_eligible_to_create_modification_proposal(luy, a_person)) self.assertFalse( perms.is_eligible_to_delete_learning_unit_year(luy, a_person))