PATH:
opt
/
imunify360
/
venv
/
lib
/
python3.11
/
site-packages
/
defence360agent
/
model
/
__pycache__
/
Editing: wp_disabled_rule.cpython-311.opt-1.pyc
� ���i�4 � � � d Z ddlmZ ddlZddlZddlmZmZmZm Z m Z mZ ddlm Z mZ ej e� � Z G d� de � � ZdS )a� WordPress-specific disabled rules data model. This module provides a separate data model for WordPress disabled rules, independent of the existing DisabledRule/DisabledRuleDomain models used by modsec/ossec plugins. Disable Behavior: Global and domain-level disables are independent and can coexist. A rule is considered effectively disabled for a given WordPress domain if EITHER of these conditions is true: - A global disable exists for the rule (applies to all domains) - A domain-specific disable exists for the rule and that domain Enabling a rule at one scope does not affect disables at the other scope. For example, removing a global disable leaves any domain-specific disables intact, and vice versa. � )�IteratorN)� CharField� FloatField�IntegerField�IntegrityError�PrimaryKeyField�fn)�Model�instancec � � e Zd ZdZ G d� d� � Z e� � Z ed�� � Z ed�� � Z ed�� � Z ed�� � Z ed�� � Z ed�� � ZdZdZd Zd Ze d$ded ee dz dedededz defd�� � Zedededededef d�� � Zeded ee dedededefd�� � Zededededz dedededefd�� � Zeded ee dz defd�� � Zed$dededz defd�� � Ze d%dededee fd�� � Z ede!e fd�� � Z"edee dz defd�� � Z#e d&d!ed"edee dz dede$eee% f f d#�� � Z&dS )'�WPDisabledRulez�Stores disabled WordPress protection rules. Uses a scope-based design: - scope='global', scope_value=NULL: Rule disabled for all domains (root only) - scope='domain', scope_value='example.com': Rule disabled for specific domain c �$ � e Zd Zej ZdZdZdS )�WPDisabledRule.Meta�wp_disabled_rules)))�rule_id�scope�scope_valueTN)�__name__� __module__�__qualname__r �db�database�db_table�indexes� � �[/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/model/wp_disabled_rule.py�Metar - s � � � � � ��;��&��@���r r F)�nullT�global�domain� wordpress�agentNr �domains�source�user_id� timestamp�returnc � � |�t j � � }|r| � |||||� � S | � ||||� � S )a> Disable a rule globally or for specific domains. Args: rule_id: The rule identifier (e.g., "CVE-2025-001") domains: List of domains to disable for, or None/empty for global disable source: Origin of the action ("wordpress" or "agent") user_id: UID of the user performing the action (0 for root) timestamp: Unix timestamp for when the rule was disabled. If None, uses current time. Returns: Number of new entries created (0 if all were no-ops). )�time�_disable_for_domains�_disable_globally)�clsr r$ r% r&