Beispiel #1
0
def listing_profile(request):
    "Returns the rendered template for profile listing."
    permission_obj = PermissionValidation(request)
    validation = permission_obj.validate('listing_profile')
    if validation['status']:
        return render(request, 'profiles/listing.html',
                      {'username': permission_obj.user.name})
    return PermissionValidation.error_response_view(validation, request)
Beispiel #2
0
def options_form(request):
    "Returns the rendered template for the given user."
    permission_obj = PermissionValidation(request)
    validation = permission_obj.validate('options_form')
    if validation['status']:
        data = {
            "success": "True",
            'username': permission_obj.user.name
        }

        return render(
            request,
            'agent_console/options_form.html',
            data
        )
    return PermissionValidation.error_response_view(validation, request)
Beispiel #3
0
def form_profile(request, profile_id=0):
    "Returns the rendered template for the given profile."
    permission_obj = PermissionValidation(request)
    validation = permission_obj.validate('form_profile')
    if validation['status']:
        if profile_id == 0:
            action = "Crear"
        else:
            action = "Actualizar"

        result = actions_by_app()
        return render(
            request, 'profiles/form.html', {
                'id': profile_id,
                'action': action,
                'result': result,
                'username': permission_obj.user.name
            })
    return PermissionValidation.error_response_view(validation, request)
Beispiel #4
0
def form_user_agent(request, user_id=0):
    "Returns the rendered template for the given user."
    permission_obj = PermissionValidation(request)
    validation = permission_obj.validate('form_user_agent')
    if validation['status']:
        if user_id == 0:
            action = "Crear"
        else:
            action = "Actualizar"

        return render(
            request,
            'agent_console/form.html',
            {
                'id':user_id,
                'action':action,
                'username': permission_obj.user.name
            }
        )
    return PermissionValidation.error_response_view(validation, request)
Beispiel #5
0
def agent_console(request):
    "Returns the rendered template for the given user."
    permission_obj = PermissionValidation(request)
    validation = permission_obj.validate('agent_console')
    if validation['status']:
        id_user = permission_obj.user.id
        try:
            user_agent = UserAgent.objects.get(user=id_user)
            id_agent = user_agent.agent
        except UserAgent.DoesNotExist:
            id_agent = "null"

        data = {
            'id_agent': id_agent,
            'username': permission_obj.user.name
        }
        return render(
            request,
            'agent_console/agent_console.html',
            data
        )
    return PermissionValidation.error_response_view(validation, request)