PATH:
opt
/
imunify360
/
venv
/
lib
/
python3.11
/
site-packages
/
defence360agent
/
simple_rpc
/
__pycache__
/
Editing: wp_disabled_rules.cpython-311.opt-1.pyc
� ���i]( � � � d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl m Z mZ ddlm Z ddlmZ ddlmZmZ dd lmZ dd lmZmZ ddlmZ ddlmZmZ dd lmZ ddlm Z ej! e"� � Z#de$de%e$ fd�Z&de$de%e$ dz de%e$ fd�Z'de%e( de(dz de%e( fd�Z) dde%e$ dedz ddfd�Z* G d� de� � Z+dS )z6RPC endpoints for WordPress disabled protection rules.� N)�MessageType)�MessageSink)�Index�WP_RULES)�WPDisabledRule)�ValidationError)�CommonEndpoints�bind)� hosting_panel)�Scope�log_future_errors)�ChangelogProcessor)�redeploy_wp_rules�update_disabled_rules_on_sites)�get_installed_sites_by_domains)�get_wp_rules_data�user�returnc � � K � t j � � }|� � � � d{V ��}|� | g � � S # t $ r(}t � d| |� � g cY d}~S d}~ww xY w)z� Get domains for a user from the hosting panel. Returns: List of domains the user owns, or empty list on error. Nz%Failed to get domains for user %s: %s)r �HostingPanel�get_domains_per_user�get� Exception�logger�warning)r �hp�domains_per_user�es �a/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/simple_rpc/wp_disabled_rules.py�_get_user_domainsr s� � � � �� � '� )� )��!#�!8�!8�!:�!:�:�:�:�:�:�:���#�#�D�"�-�-�-��� � � ����>��a�H�H�H�� � � � � � ��������s �AA � A9�A4�.A9�4A9�domainsc � � �K � t | � � � d{V ���|s�st d� � ��S �fd�|D � � }|st d� � �|S )a� Validate and filter domains for a non-root user. If no domains specified, returns all user's domains. If domains specified, filters to only those the user owns. Args: user: Username to validate domains for domains: Requested domains, or None for all user's domains Returns: List of validated domains the user can access Raises: ValidationError: If user has no domains or no access to requested domains NzNo domains found for userc � �� g | ]}|�v �|�� S � r$ ��.0�d�user_domainss �r � <listcomp>z*_validate_user_domains.<locals>.<listcomp>H s# �� �B�B�B���\�0A�0A�!�0A�0A�0A� z5You don't have access to any of the specified domains)r r )r r! �authorized_domainsr( s @r �_validate_user_domainsr, / s� �� � � �&