예제 #1
0
    def test_cannot_faculty_manager_modify_end_date_full(self):
        for proposal_needed_container_type in TYPES_PROPOSAL_NEEDED_TO_EDIT:
            lunit_container_yr = LearningContainerYearFactory(academic_year=self.academic_yr,
                                                              container_type=proposal_needed_container_type)
            luy = LearningUnitYearFactory(academic_year=self.academic_yr,
                                          learning_container_year=lunit_container_yr,
                                          subtype=FULL)

            self.assertFalse(perms.is_eligible_for_modification_end_date(luy, self.create_person_with_permission_and_group(FACULTY_MANAGER_GROUP)))
예제 #2
0
 def f_can_perform_end_date_modification(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_for_modification_end_date(
             learn_unit_year, pers):
         raise PermissionDenied(
             "Learning unit year date is not editable or user has not sufficient rights."
         )
     return view_func(request, learning_unit_year_id)
예제 #3
0
 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))
예제 #4
0
 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))
예제 #5
0
 def test_can_central_manager_modify_end_date_full(self):
     a_person = self.create_person_with_permission_and_group(
         CENTRAL_MANAGER_GROUP)
     generated_container = GenerateContainer(
         start_year=self.academic_yr.year, end_year=self.academic_yr.year)
     generated_container_first_year = generated_container.generated_container_years[
         0]
     luy = generated_container_first_year.learning_unit_year_full
     requirement_entity = generated_container_first_year.requirement_entity_container_year.entity
     PersonEntityFactory(entity=requirement_entity, person=a_person)
     for proposal_needed_container_type in ALL_TYPES:
         self.lunit_container_yr.container_type = proposal_needed_container_type
         self.lunit_container_yr.save()
         self.assertTrue(
             perms.is_eligible_for_modification_end_date(luy, a_person))
예제 #6
0
 def test_can_central_manager_modify_end_date_full(self):
     a_person = create_person_with_permission_and_group(
         CENTRAL_MANAGER_GROUP, 'can_edit_learningunit')
     a_person.user.user_permissions.add(
         Permission.objects.get(codename='can_edit_learningunit_date'))
     generated_container = GenerateContainer(start_year=self.academic_yr,
                                             end_year=self.academic_yr)
     generated_container_first_year = generated_container.generated_container_years[
         0]
     luy = generated_container_first_year.learning_unit_year_full
     requirement_entity = generated_container_first_year.requirement_entity_container_year
     PersonEntityFactory(entity=requirement_entity, person=a_person)
     lunit_container_yr = LearningContainerYearFactory(
         academic_year=self.academic_yr)
     for proposal_needed_container_type in ALL_TYPES:
         lunit_container_yr.container_type = proposal_needed_container_type
         lunit_container_yr.save()
         self.assertTrue(
             perms.is_eligible_for_modification_end_date(luy, a_person))
예제 #7
0
def get_learning_unit_identification_context(learning_unit_year_id, person):
    context = get_common_context_learning_unit_year(learning_unit_year_id,
                                                    person)

    learning_unit_year = context['learning_unit_year']
    proposal = proposal_learning_unit.find_by_learning_unit_year(
        learning_unit_year)

    context[
        'learning_container_year_partims'] = learning_unit_year.get_partims_related(
        )
    context['organization'] = get_organization_from_learning_unit_year(
        learning_unit_year)
    context['campus'] = get_campus_from_learning_unit_year(learning_unit_year)
    context['experimental_phase'] = True
    context['show_subtype'] = show_subtype(learning_unit_year)
    context.update(get_all_attributions(learning_unit_year))
    context['components'] = get_components_identification(learning_unit_year)
    context['proposal'] = proposal
    context[
        'proposal_folder_entity_version'] = mdl_base.entity_version.get_by_entity_and_date(
            proposal.folder.entity, None) if proposal else None
    context['differences'] = _get_difference_of_proposal(proposal)

    # perms learning unit
    context['can_propose'] = is_eligible_to_create_modification_proposal(
        learning_unit_year, person)
    context['can_edit_date'] = is_eligible_for_modification_end_date(
        learning_unit_year, person)
    context['can_edit'] = is_eligible_for_modification(learning_unit_year,
                                                       person)
    context['can_delete'] = can_delete_learning_unit_year(
        learning_unit_year, person)

    # perms proposal
    context['can_cancel_proposal'] = is_eligible_for_cancel_of_proposal(
        proposal, person)
    context['can_edit_learning_unit_proposal'] = is_eligible_to_edit_proposal(
        proposal, person)

    return context
예제 #8
0
 def test_can_central_manager_modify_end_date_full(self):
     for proposal_needed_container_type in ALL_TYPES:
         self.lunit_container_yr.container_type = proposal_needed_container_type
         self.lunit_container_yr.save()
         person = self.create_person_with_permission_and_group(CENTRAL_MANAGER_GROUP)
         self.assertTrue(perms.is_eligible_for_modification_end_date(self.luy, person))