File manager - Edit - /opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/simple_rpc/__pycache__/wordpress_security_plugin.cpython-311.pyc
Back
� ַ9j � �" � d dl Z d dlZd dlZd dlmZ d dlmZmZmZ d dl m Z mZ d dlm Z d dlmZ d dlmZ d dlmZ d d lmZ e j e� � Z dd edz dedz deedz edz f fd �Z G d� de� � Z G d� de� � ZdS )� N)�ValidationError)�CommonEndpoints� RootEndpoints�bind)�Scope�is_root_user)�MessageType)�get_wordpress_incidents)�$enrich_incidents_with_disabled_state)�get_installed_sites_paginated)�get_domain_paths�user�site_search�returnc �x � t j � � }t � � r�t � d| � � d}| �s t j | � � j }t � d| |� � n<# t $ r/ t � d| � � t d| � d�� � �w xY w||fS ||fS )a� Determine the user_id and site_path for filtering WordPress incidents. Three calling contexts: 1. Root user: Can query all incidents or filter by specific user 2. Non-root user: Can only query their own incidents (user/site_search ignored) 3. Proxy service: Both user and site_search must be set, restricted to that site Args: user: Username to filter by site_search: Site path to filter by Returns: Tuple of (user_id, site_path) to filter by, or (None, None) for all Raises: KeyError: If the specified user doesn't exist ValueError: If proxy service call is missing required parameters z-Root user querying incidents, user filter: %sNz(Filtering incidents for user %s (uid=%d)zUser not found: %szUser 'z' not found) �os�getuidr �logger�debug�pwd�getpwnam�pw_uid�KeyError�warning)r r �current_uid�user_ids �i/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/simple_rpc/wordpress_security_plugin.py�get_user_id_and_site_for_queryr s� � �, �)�+�+�K��~�~� $����D�d�K�K�K����� ;��,�t�,�,�3�����>��g�� � � �� � ;� ;� ;����3�T�:�:�:��9��9�9�9�:�:�:� ;���� ��#�#���#�#s �5A8 �89B1c �� � e Zd Zej Z edd� � d� � � Z edd� � d� � � Z edd� � d� � � Z edd� � d � � � Z d S )�WordpressEndpoints�wordpress-pluginzinstall-on-new-sitesc � �p K � | j � t j d�� � � � � d {V �� d S )N�install_on_new_sites��action��_sink�process_messager �WordpressPluginAction��selfs r �wordpress_plugin_installz+WordpressEndpoints.wordpress_plugin_installG sZ � � � ��j�(�(��-�5K�L�L�L� � � � � � � � � � � � ztidy-upc � �p K � | j � t j d�� � � � � d {V �� d S )N�tidy_upr$ r&