Server IP : 192.158.238.246 / Your IP : 18.216.1.197 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python37/lib/python3.7/site-packages/paste/auth/__pycache__/ |
Upload File : |
B a�N� � @ s. d Z ddlmZ G dd� de�Zd dd�ZdS ) z- Grant roles and logins based on IP address. � )�ip4c @ s2 e Zd ZdZddd�Zdd� Zdd� Zd d � ZdS ) �GrantIPMiddlewarea On each request, ``ip_map`` is checked against ``REMOTE_ADDR`` and logins and roles are assigned based on that. ``ip_map`` is a map of {ip_mask: (username, roles)}. Either ``username`` or ``roles`` may be None. Roles may also be prefixed with ``-``, like ``'-system'`` meaning that role should be revoked. ``'__remove__'`` for a username will remove the username. If ``clobber_username`` is true (default) then any user specification will override the current value of ``REMOTE_USER``. ``'__remove__'`` will always clobber the username. ``ip_mask`` is something that `paste.util.ip4:IP4Range <class-paste.util.ip4.IP4Range.html>`_ can parse. Simple IP addresses, IP/mask, ip<->ip ranges, and hostnames are allowed. Tc C sR || _ g | _x:|�� D ].\}}| j�t�|�| �|d |d �f� qW || _d S )Nr � )�app�ip_map�items�appendr ZIP4Range�_convert_user_role�clobber_username)�selfr r r �key�value� r �C/opt/alt/python37/lib/python3.7/site-packages/paste/auth/grantip.py�__init__ s zGrantIPMiddleware.__init__c C s |rt |t�r|�d�}||fS )N�,)� isinstance� basestring�split)r �username�rolesr r r r $ s z$GrantIPMiddleware._convert_user_rolec C s� t �|d d�}d}g }xV| jD ]L\}\}}||kr |rB|�|� |dkrPd}q |r |�d�rd| jr ||d<