403Webshell
Server IP : 65.108.144.40  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64
User : dev ( 1000)
PHP Version : 8.2.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/erp/recruitment/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/erp/recruitment/__pycache__/decorators.cpython-310.pyc
o

hͦh�@s�dZddlmZddlmZddlmZmZddlm	Z	m
Z
ddlmZddl
mZmZdd	�Zed
d��Zedd
��Zdd�ZdS)zX
decorators.py

Custom decorators for permission and manager checks in the application.
���wraps)�messages)�HttpResponse�HttpResponseRedirect)�redirect�render)�Employee)�Recruitment�Stagecs�fdd�}|S)z�
    Decorator that allows decorators to accept arguments and keyword arguments.

    Args:
        decorator (function): The decorator function to be wrapped.

    Returns:
        function: The wrapper function.

    cs���fdd�}|S)a
        Wrapper function that captures the arguments and keyword arguments.

        Args:
            *args: Variable length argument list.
            **kwargs: Arbitrary keyword arguments.

        Returns:
            function: The inner wrapper function.

        cs�|g��Ri���S)z�
            Inner wrapper function that applies the decorator to the function.

            Args:
                func (function): The function to be decorated.

            Returns:
                function: The decorated function.

            �)�func)�args�	decorator�kwargsr�&/var/www/erp/recruitment/decorators.py�
inner_wrapper*sz@decorator_with_arguments.<locals>.wrapper.<locals>.inner_wrapperr)rrr�r)rrr�wrappers

z)decorator_with_arguments.<locals>.wrapperr)rrrrr�decorator_with_argumentssrc���fdd�}|S)z�
    Decorator that checks if the user has the specified permission or is a manager.

    Args:
        perm (str): The permission to check.

    Returns:
        function: The decorated function.

    Raises:
        None

    c	s�|j}tjj|d���}tjj|d���ptjj|d���}|���s%|r0�|g|�Ri|��St	�
|d�|j�dd�}d|�d�}d	}||j�
�vrQt|d
�St|�S)aR
        Inner function that performs the permission and manager check.

        Args:
            request (HttpRequest): The request object.
            *args: Variable length argument list.
            **kwargs: Arbitrary keyword arguments.

        Returns:
            HttpResponse: The response from the decorated function.

        ��employee_user_id)�stage_managers��recruitment_managers�You dont have permission.�HTTP_REFERER�/� <script>window.location.href = "�
"</script>�HTTP_HX_REQUEST�decorator_404.html)�userr	�objects�filter�firstr�existsr
�has_permr�info�META�get�keysrr�	�requestrrr#�employee�
is_manager�previous_url�script�key��function�permrr�	_functionLs
�
z$manager_can_enter.<locals>._functionr�r5r6r7rr4r�manager_can_enter<sr9cr)z�
    Decorator that checks if the user has the specified permission or is a recruitment manager.

    Args:
        perm (str): The permission to check.

    Returns:
        function: The decorated function.

    Raises:
        None

    c	s�|j}tjj|d���}tjj|d���}|���s|r'�|g|�Ri|��St�	|d�|j
�dd�}d|�d�}d}||j
��vrHt
|d	�St|�S)
aQ
        Inner function that performs the permission and manager check.

        Args:
            request (HttpRequest): The request object.
            *args: Variable length argument list.
            **kwargs: Arbitrary keyword arguments.

        Returns:
            HttpResponse: The response from the decorated function.
        rrrrrrr r!r")r#r	r$r%r&r
r'r(rr)r*r+r,rrr-r4rrr7|s
z0recruitment_manager_can_enter.<locals>._functionrr8rr4r�recruitment_manager_can_enterlsr:cst���fdd��}|S)Ncs�|j�d�r�|g|�Ri|��S|jr-|jjj��s"|jjj��r-�|g|�Ri|��Sd|jvr=�|g|�Ri|��Std�S)Nzrecruitment.view_candidate�candidate_idzcandidate-login)r#r(�employee_get�	stage_setr'�recruitment_set�sessionr)r.rr��	view_funcrr�
_wrapped_view�s��
z/candidate_login_required.<locals>._wrapped_viewr)rArBrr@r�candidate_login_required�srCN)�__doc__�	functoolsr�django.contribr�django.httprr�django.shortcutsrr�employee.modelsr	�recruitment.modelsr
rrr9r:rCrrrr�<module>s+
/
+

Youez - 2016 - github.com/yon3zu
LinuXploit