def user_is_assistant_and_can_see_file(user):
    try:
        if user.is_authenticated() and settings.assistants_can_see_file():
            return academic_assistant.find_by_person(user.person)
        else:
            return False
    except ObjectDoesNotExist:
        return False
Exemple #2
0
def user_is_assistant_and_can_see_file(user):
    try:
        if user.is_authenticated and settings.assistants_can_see_file():
            return academic_assistant.find_by_person(user.person)
        else:
            return False
    except ObjectDoesNotExist:
        return False
 def get_context_data(self, **kwargs):
     context = super(AssistantMandatesListView, self).get_context_data(**kwargs)
     context['assistant'] = academic_assistant.find_by_person(person.find_by_user(self.request.user))
     context['current_academic_year'] = current_academic_year()
     context['can_see_file'] = settings.assistants_can_see_file()
     for mandate in context['object_list']:
         entities_id = mandate.mandateentity_set.all().order_by('id').values_list('entity', flat=True)
         mandate.entities = base.models.entity.find_versions_from_entites(entities_id,
                                                                          mandate.academic_year.start_date)
     return context
Exemple #4
0
 def get_context_data(self, **kwargs):
     context = super(AssistantMandatesListView,
                     self).get_context_data(**kwargs)
     context['assistant'] = academic_assistant.find_by_person(
         person.find_by_user(self.request.user))
     context['can_see_file'] = settings.assistants_can_see_file()
     for mandate in context['object_list']:
         entities_id = mandate.mandateentity_set.all().order_by(
             'id').values_list('entity', flat=True)
         mandate.entities = base.models.entity.find_versions_from_entites(
             entities_id, mandate.academic_year.start_date)
     return context
Exemple #5
0
def assistant_home(request):
    if (settings.access_to_procedure_is_open() or settings.assistants_can_see_file()) \
            and academic_assistant.find_by_person(person=request.user.person):
        return HttpResponseRedirect(reverse('assistant_mandates'))
    else:
        try:
            manager.find_by_person(person=request.user.person)
            return HttpResponseRedirect(reverse('manager_home'))
        except manager.Manager.DoesNotExist:
            if reviewer.find_by_person(person=request.user.person):
                return HttpResponseRedirect(reverse('reviewer_mandates_list_todo'))
            else:
                return HttpResponseRedirect(reverse('access_denied'))
Exemple #6
0
def assistant_home(request):
    if (settings.access_to_procedure_is_open() or settings.assistants_can_see_file()) \
            and academic_assistant.find_by_person(person=request.user.person):
        return HttpResponseRedirect(reverse('assistant_mandates'))
    else:
        try:
            manager.find_by_person(person=request.user.person)
            return HttpResponseRedirect(reverse('manager_home'))
        except manager.Manager.DoesNotExist:
            if reviewer.find_by_person(person=request.user.person):
                return HttpResponseRedirect(
                    reverse('reviewer_mandates_list_todo'))
            else:
                return HttpResponseRedirect(reverse('access_denied'))
 def test_func(self):
     return (assistant_access.user_is_assistant_and_procedure_is_open(
         self.request.user)
             or (academic_assistant.find_by_person(self.request.user.person)
                 and settings.assistants_can_see_file()))
 def test_func(self):
     return (assistant_access.user_is_assistant_and_procedure_is_open(self.request.user) or
             (academic_assistant.find_by_person(self.request.user.person) and settings.assistants_can_see_file()))