????
Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/clwpos/__pycache__/ |
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/clwpos/__pycache__/billing.cpython-311.opt-1.pyc |
� ٯ]fb � � � d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZmZ d dl m Z d dlmZ d dl mZ d dlmZmZ d dlmZmZmZmZ d dlmZ d d lmZ d d lmZmZmZmZmZ d dl m!Z! G d� d e � � Z"ee"j# ee"j# ee"j# ee"j$ iZ%d� Z&d� Z'd� Z(e G d� d� � � � Z)e G d� d� � � � Z*d� Z+d� Z,d� Z-d� Z.dS )� N)� dataclass�asdict)�Enum)�drop_privileges)�cpinfo)�List�Dict)�get_allowed_modules�get_admin_suites_config�write_suites_allowed� ALL_SUITES)�CDNSuitePro)�FeatureStatusEnum)�OBJECT_CACHE_FEATURE�CRITICAL_CSS_FEATURE�IMAGE_OPTIMIZATION_FEATURE�CDN_FEATURE�Feature)� UserConfigc � � e Zd ZdZdZdZdZdS )�BillingFeaturezA Backwards-compatible list of features that we bill for. zAccelerateWP PremiumzAccelerateWP CDN FreezAccelerateWP CDN ProN)�__name__� __module__�__qualname__�__doc__�ACCELERATE_WP_PREMIUM�ACCELERATE_WP_CDN�ACCELERATE_WP_CDN_PRO� � �py/clwpos/billing.pyr r s. � � � � � �� � 3��/��2���r r c � � | t k rt � | � � S t j |v rt j S t � | � � S )N)r �FEATURE_TO_BILLING_FEATURE�getr �namer r )�feature�allowed_suitess r! �billing_feature_by_awp_featurer( 0 sL � ��+���)�-�-�g�6�6�6���>�)�)��3�3�%�)�)�'�2�2�2r c �8 � | �dS t j d| � � duS )z- Checks that string has uuid4 format NFzK[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})�re�match)�values r! � is_valid_uuidr- 9 s( � � �}��u� �8�a�ch�i�i�qu�u�ur c �R � t j � � rt � � S t j | � � }t |j � � }|j }|�t |� � s@t t j � � � � |_ t |j |j |� � |j S )z� We need some unique identifier which user can use as his token on our provisioning server. We use uuid4 to make it somehow hard to bruteforce and still unique (hopefully as we don't check that :P) )�os�geteuid�get_unique_identifier_as_user�pwd�getpwnamr �pw_uid� unique_idr- �str�uuid�uuid4r �pw_gid)�username�pw�configr5 s r! �get_or_create_unique_identifierr= B s� � � �z�|�|� /�,�.�.�.� ��h� � �B� $�R�Y� /� /�F�� �I��� �i� 8� 8���t�z�|�|�,�,����R�Y�� �6�:�:�:���r c �8 � e Zd ZU eed<